CC2530: Is Timer 2 needed if using only the 802.15.4 PHY in the CC2530?

Part Number: CC2530
Other Parts Discussed in Thread: CC2533, , Z-STACK

Tool/software:

On the CC2530 and CC2533, if the 802.15.4 PHY is used, but not the 802.15.4 MAC, is the Timer 2 (MAC Timer) needed?  The user guide states 

Timer 2 is mainly used to provide timing for 802.15.4 command-strobe-processor algorithms and for general timekeeping in the 802.15.4 MAC layer on CC253x devices,

Does this mean that it's needed when using the Program Execution mode with the CSP or does it apply to immediate command strobe execution as well (writing a single command to RFST).

However, in the CC2530B version of hal_sleep in Z-Stack 3.02, there is the following code.

/* power on the MAC; blocks until completion */
MAC_PwrOnReq();

HAL_ENABLE_INTERRUPTS();

/* For CC2530, T2 interrupt won’t be generated when the current count is greater than
* the comparator. The interrupt is only generated when the current count is equal to
* the comparator. When the CC2530 is waking up from sleep, there is a small window
* that the count may be grater than the comparator, therefore, missing the interrupt.
* This workaround will call the T2 ISR when the current T2 count is greater than the
* comparator. The problem only occurs when POWER_SAVING is turned on, i.e. the 32KHz
* drives the chip in sleep and SYNC start is used.
*/
macMcuTimer2OverflowWorkaround();

Does this matter if not using the 802.15.4 MAC layer?

  • Hi,

    Does this mean that it's needed when using the Program Execution mode with the CSP or does it apply to immediate command strobe execution as well (writing a single command to RFST).

    Immediate commands should not require a timer. CSP is the interface between MCU and Radio, and in a Zigbee application the MAC layer actually uses it (rather than the Application layer). There are some processes in the MAC where it makes sense to sleep (and thus use a timer). If your application is not requiring this (by nature of not using the MAC), the I don't think T2 is needed.

    Does this matter if not using the 802.15.4 MAC layer?

    The condition detailed in the code comment is still relevant for T2, but the workaround itself (macMcuTimer2OverflowWorkaround) is only relevant while the MAC is actively used. This is because the MAC would have code to initialize usage of T2 (as well as other processes where it makes sense to sleep and use as wakeup timer).

    Note that it's usually expected that the MAC would be used alongside the 802.15.4 PHY.

    Thanks,
    Toby