Other Parts Discussed in Thread: CC2540
Hello I have searched many "sleep" posts but was not able to find any specifics related to CC2540.
Background: Using Keyfob demo project with 2540 MINI DK. I would like to put the processor into PM2 and have it wakeup after desired time (100msec, 250msec, etc). I have modified the below code but I can not get it to work and processor is always awake. I have tried different values for TEST_SLEEP_TIME (from ms to s) with no luck. I know the values have to be based on 32khz which that is what I load into this const. I also know that timeout is peeking into radio & os_timers to get shortest time for sleep.
The processor seems to go to sleep OK when I revert code to the original TI code (ie using the timeout var).
hal_sleep.c { function void halSleep( uint32 osal_timeout ) }
if (timeout != 0)
{
// check if the time to next wake event is greater than max sleep time
if (timeout > MAX_SLEEP_TIME )
{
// it is, so limit to max allowed sleep time (~510s)
halSleepSetTimer( sleepTimer, MAX_SLEEP_TIME );
}
else // not more than allowed sleep time
{
// so set sleep time to actual amount
halSleepSetTimer( sleepTimer, /*timeout*/ TEST_SLEEP_TIME );
}
}
Timer conversion formula ..... TEST_SLEEP_TIME = Desired Time / 30.51usec { this is not the code, just a conversion formula }
Any help is appreciated as to why when I modify the code it does not work.
~LD