This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

What is the relationship between PM2 and Sleep Timer for cc2530?

Other Parts Discussed in Thread: CC2530, CC2430

Dear all,

I have a problem with PM2 and sleep timer. And my project is based on BasicRF sample for cc2530.

My application needs sleep timer to call MCU back to active from PM2. So i test sleep timer first. In halBoardInit() function, i set up sleep timer as follows:

    //sleep timer

    halStartSleepTimer();     

    halSetSleepTimer(4);     

In sleep timer ISR, i set a flag named sleepTimerFlag as follows:

#pragma vector= ST_VECTOR

__interrupt void sleepTimer_IRQ(void)

  STIF=0;   

  SLEEPCMD &= 0xfc;    

  sleepTimerFlag = 1;

}

And in while loop located in Main function, i check the sleepTimerFlag  flag. if this flag is set, then i toggle a LED, clear the flag to 0, and set up all the sleep timer paras.Finally, i make cc2530 into PM2 state. It is listed as follows:

while(1)

{

        if(basicRfPacketIsReady())

        {        

          .....................................

        }

        if(sleepTimerFlag == 1)

        {

            sleepTimerFlag = 0;

            halLedToggle(2);

            halStartSleepTimer();     

            halSetSleepTimer(3);     

            halSetPowerMode(2);      //Problem here

        }

}

 

The  code snap listed above is the program schedule i want to achieve.

The problem is, if i add the halSetPowerMode(2) in while loop, i can't see my LED toggle after some seconds, which means that cc2530 can't get into the sleep timer ISR.

If i remove the  halSetPowerMode(2) in while loop, i can see my LED toggle all the time.

So, is there any relationship between  halSetPowerMode(2) and Sleep timer ? 

Thanks a lot!

  • Dear all,

    For a hard troubleshooting time these days, i found that i didn't choose the right 32k clock for sleep timer.

    It works if i choose the right 32k clock(Actually, i chose internal 32k clock of cc2530).

  • Hello Jiong Shi, I'm also busy with a BasicRF sample (PER test). I'm using the cc2430 but that's almost the same as cc2530. And I also want to use the PM2 and sleep timer. My application also needs sleep timer to call MCU back to active from PM2. I want to use the sleep timer so that in the time I have between sending 2 packages I have a very low power consumption. But I have absolutly no idea how I must implement this al in the BasicRF sample. I also can't find the halStartSleepTimer() and all other sleep functions that you are using. Can you help me with my problem? And can you tell me where you found all the sleepTimer functions? Thank you very very much!!!
  • It seems to me, when I look at   http://e2e.ti.com/support/low_power_rf/f/155/t/123977.aspx

    that you have written the halStartSleepTimer() and all other sleep functions by yourself.

    My problem is that when I have send a packet then I want to wait 33msec in PM2. and after those 33msec I want to send a new packet and then I want to wait again 33msec in PM2 and so on.


    I am already able to send those packages in a while(TRUE){} loop. And I use for the moment a 32kHztimer interrupt to wait 33msec between sending of my packages.

    But I don't understand how I must replace my 32kHztimer interrupt with a sleep function in PM2 like you did !

    Can you give me some advice with your functions (halStartSleepTimer(),...). To fix my problem??

    Thank you very much!!!