I'm trying to develop a driver to pulse a LED with cc254x PWM, in a real-world battery driven device.
Thus, I'm having to manage power management features as the PWM pulses begin and end.
What I'm seeing is that if at the start of PWM, I call
osal_pwrmgr_device( PWRMGR_ALWAYS_ON );
HCI_EXT_ClkDivOnHaltCmd( HCI_EXT_DISABLE_CLK_DIVIDE_ON_HALT );
Then the PWM becomes smooth, and if at the end of PWM I call
osal_pwrmgr_device( PWRMGR_BATTERY );
HCI_EXT_ClkDivOnHaltCmd( HCI_EXT_ENABLE_CLK_DIVIDE_ON_HALT );
Then power management does seem to be restored.
However, if I begin a PWM pulse just after using an interrupt to wake from PM3, by using
CLEAR_SLEEP_MODE();
within the ISR, then the first pulse just after waking, is glitchy- the timers are inaccurate. Subsequent pulses are smooth and accurate. This is unfortuneate, as I want to use the PWM LED pulse to indicate that the device has awoken. I've tried adding a delay and changing the order of events to no avail.
Does this ring any bells, has anyone had any luck writing a driver to make PWM and PM play nicely together on the cc254x?
Tim