add ref. crystal trimming.
This commit is contained in:
parent
78be082b3c
commit
eb94e7daaf
|
@ -1,10 +1,21 @@
|
||||||
#ifndef BOARD_REDBEE_DEV_H
|
#ifndef BOARD_REDBEE_DEV_H
|
||||||
#define BOARD_REDBEE_DEV_H
|
#define BOARD_REDBEE_DEV_H
|
||||||
|
|
||||||
#include <std_conf.h>
|
|
||||||
|
|
||||||
#define LED_RED (1 << 23)
|
#define LED_RED (1 << 23)
|
||||||
#define LED_GREEN (1 << 24)
|
#define LED_GREEN (1 << 24)
|
||||||
#define LED_BLUE (1 << 25)
|
#define LED_BLUE (1 << 25)
|
||||||
|
|
||||||
|
/* XTAL TUNE parameters */
|
||||||
|
/* see http://devl.org/pipermail/mc1322x/2009-December/000162.html */
|
||||||
|
/* for details about how to make this measurment */
|
||||||
|
|
||||||
|
/* Coarse tune: add 4pf */
|
||||||
|
#define CTUNE_4PF 1
|
||||||
|
/* Coarse tune: add 0-15 pf */
|
||||||
|
#define CTUNE 3
|
||||||
|
/* Fine tune: add FTUNE * 156fF (FTUNE is 4bits) */
|
||||||
|
#define FTUNE 6
|
||||||
|
|
||||||
|
#include <std_conf.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,10 +1,21 @@
|
||||||
#ifndef BOARD_REDBEE_R1_H
|
#ifndef BOARD_REDBEE_R1_H
|
||||||
#define BOARD_REDBEE_R1_H
|
#define BOARD_REDBEE_R1_H
|
||||||
|
|
||||||
#include <std_conf.h>
|
|
||||||
|
|
||||||
#define LED_RED (1 << 8)
|
#define LED_RED (1 << 8)
|
||||||
#define LED_GREEN (1 << 9)
|
#define LED_GREEN (1 << 9)
|
||||||
#define LED_BLUE (1 << 10)
|
#define LED_BLUE (1 << 10)
|
||||||
|
|
||||||
|
/* XTAL TUNE parameters */
|
||||||
|
/* see http://devl.org/pipermail/mc1322x/2009-December/000162.html */
|
||||||
|
/* for details about how to make this measurment */
|
||||||
|
|
||||||
|
/* Coarse tune: add 4pf */
|
||||||
|
#define CTUNE_4PF 1
|
||||||
|
/* Coarse tune: add 0-15 pf */
|
||||||
|
#define CTUNE 3
|
||||||
|
/* Fine tune: add FTUNE * 156fF (FTUNE is 4bits) */
|
||||||
|
#define FTUNE 2
|
||||||
|
|
||||||
|
#include <std_conf.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,4 +7,24 @@
|
||||||
#define vreg_init() default_vreg_init()
|
#define vreg_init() default_vreg_init()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* XTAL TUNE parameters */
|
||||||
|
/* recommended defaults from the datasheet */
|
||||||
|
|
||||||
|
/* Coarse tune: add 4pf */
|
||||||
|
#ifndef CTUNE_4PF
|
||||||
|
#define CTUNE_4PF 1
|
||||||
|
#endif
|
||||||
|
/* Coarse tune: add 0-7 pf */
|
||||||
|
#ifndef CTUNE
|
||||||
|
#define CTUNE 5
|
||||||
|
#endif
|
||||||
|
/* Fine tune: add FTUNE * 156fF (FTUNE is 4bits) */
|
||||||
|
#ifndef FTUNE
|
||||||
|
#define FTUNE 16
|
||||||
|
#endif
|
||||||
|
/* datasheet recommends taht you don't change this */
|
||||||
|
#ifndef IBIAS
|
||||||
|
#define IBIAS 0x1F
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -97,4 +97,7 @@
|
||||||
#define SLEEP_RAM_64K sleep_ram_retain(2)
|
#define SLEEP_RAM_64K sleep_ram_retain(2)
|
||||||
#define SLEEP_RAM_96K sleep_ram_retain(3)
|
#define SLEEP_RAM_96K sleep_ram_retain(3)
|
||||||
|
|
||||||
|
#define pack_XTAL_CNTL(ctune4pf, ctune, ftune, ibias) \
|
||||||
|
(*CRM_XTAL_CNTL = ((ctune4pf << 25) | (ctune << 21) | ( ftune << 16) | (ibias << 8) | 0x52))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,6 +52,9 @@ void main(void) {
|
||||||
vreg_init();
|
vreg_init();
|
||||||
init_phy();
|
init_phy();
|
||||||
|
|
||||||
|
/* trim the reference osc. to 24MHz */
|
||||||
|
pack_XTAL_CNTL(CTUNE_4PF, CTUNE, FTUNE, IBIAS);
|
||||||
|
|
||||||
set_power(0x0f); /* 0dbm */
|
set_power(0x0f); /* 0dbm */
|
||||||
set_channel(0); /* channel 11 */
|
set_channel(0); /* channel 11 */
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,9 @@ void main(void) {
|
||||||
flyback_init();
|
flyback_init();
|
||||||
init_phy();
|
init_phy();
|
||||||
|
|
||||||
|
/* trim the reference osc. to 24MHz */
|
||||||
|
pack_XTAL_CNTL(CTUNE_4PF, CTUNE, FTUNE, IBIAS);
|
||||||
|
|
||||||
set_power(0x0f); /* 0dbm */
|
set_power(0x0f); /* 0dbm */
|
||||||
set_channel(0); /* channel 11 */
|
set_channel(0); /* channel 11 */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue