SWRU271I October 2010 – January 2020 CC2540 , CC2540T , CC2541 , CC2541-Q1 , CC2640R2F
Before entering sleep, the stack sets the sleep timer to wake before the next Bluetooth Low Energy event. The closer the wakeup is to the event, less power is wasted. If the wakeup is too close to the even, the sleep time might miss the event.
When the timer wakes, it must wait for the 32-MHz external crystal to stabilize. This stabilization time is affected by the inherent stabilization time of the crystal, how long the crystal has been off, the temperature, the voltage, and so forth. You must add a buffer to the wakeup time (that is, start earlier) to handle this variability in stabilization.
This buffer time is implemented using the HAL_SLEEP_ADJ_TICKS definition where the value of the definition corresponds to the number of 32-MHz ticks. This definition is set in hal_sleep.c to 25 for the CC2541 EM and 35 for the CC2540 EM by default. If the value of the definition is larger, the buffer time is longer and more power is wasted. Calculate this value empirically. If HAL_SLEEP_ADJ_TICKS is set too low, false advertisement restarts and connection drops occur. If these restarts and drops occur, increase the definition until they stop.