I have been trying for weeks now to try and put the CC2530 to sleep and wake it up using the sleep timer at regular intervals.
The sample codes that is provided by TI doesn't include a sleep function and the user guide doesn't explain things either. I have configured some of the registers as below...
void main()
{....configure clocks etc
SLEEPCMD|=0X05; //power mode 1
/*load values into registers*/
while (STLOAD == 0);
ST2=0X00;
ST1=0XFA;
ST0=0X00;
STIE=1;
EA=1;
PCON=0X01;//go to sleep
}
#pragma vector=ST_VECTOR
__interrupt void sleeptimer_int()
{
STIF = 0; //clear interrupt flag
/*load values again*/
while (STLOAD == 0);
ST2=0X00;
ST1=0XFA;
ST0=0X00;
}
It just doesn't seem to work. I've put a breakpoint at the sleep timer interrupt but it never goes there. Can someone please post a code snippet that simply puts the MCU to sleep and then wakes it up using the sleep timer interrupt at say 2sec?