AN2262 Motorola / Freescale Semiconductor, AN2262 Datasheet - Page 80

no-image

AN2262

Manufacturer Part Number
AN2262
Description
Wireless HC08 Modem
Manufacturer
Motorola / Freescale Semiconductor
Datasheet
AN2262/D
//////////////////////////////////////////////////////////
// RF initialization
// basic init, it is assumed that timers and
// other resources are in after-reset state
void RF_Init(BYTE* romeoCfg)
{
}
80
RF_RxTimeoutOff();
// transmitter idle
rfTxActive = 0;
// receiver also idle
rfRxActive = 0;
StrobeEnable();
RF_RESETB = 1;
// shut down the transmitter
RF_DAT = 0;
RF_PLLEN = 0;
RFModeDisable();
// configure TIM2 CH0 (RF_ManchesterOff)
RFTimerTXD = 0x10;
RF_RESETB = 0;
// setup SPI
SPCR = 0x28;
SPSCR = 3;
SPCR_SPE = 1; // enable and reset SPI
while(!SPSCR_SPTE) {/* DO NOTHING & WAIT! */};
for(i=0; i<3; i++)
{
}
DischargeAGC();
SPCR = 0x8;
SPCR_SPE = 0; // disable SPI
RF_RESETB = 1;
SPDR = romeoCfg[i];
// wait for finishing the transmission
while(!SPSCR_SPRF) {/* DO NOTHING & WAIT! */};
// clear SPRF
SPSCR; SPDR;
// no ints, master, cpol=0, cpha=1
// baud rate divisor 128
// put SPI into reset (as slave)
// needs to be 1 before entering reset
// enter configuration state
// enable ROMEO as SPI master
// no irq, output compare, pin ctl, no tgl, no chmax
// disable RX timeout for case we’re in receiving some bytes
Wireless HC08 Modem
MOTOROLA

Related parts for AN2262