AnsweredAssumed Answered

Switching between HSRun mode and Run mode messes up the timer period (KSDK, FRDMK22F)

Question asked by Priya Dwivedula on Jan 21, 2016
Latest reply on Jan 25, 2016 by Priya Dwivedula

I followed the sample code provided with power_manager_hal_demo_frdmk22f to switch between HSrunmode and Run mode. I am using CLOCK_SYS_UpdateConfiguration() and POWER_SYS_SetMode() to switch between the two modes which according to documentation should notify the registered drivers. My UART is working fine but the timer is not.

 

Here is the procedure I follow in my code:

Start a periodic timer

Whenever the timer expires (it's a loop as the timer is periodic),

     Process some data and switch between HSrun and Run modes to be able to write to flash

     Wait for the timer to expire

end of loop

 

I see that if I restart the HW timer using HWTIMER_SYS_Stop and HWTIMER_SYS_Start, the periodic timer never gets fired after the first time and if I don't restart the timer, the timer gets fired but after a very long time as if it's period got changed.

 

I also tried calling HWTIMER_SYS_SetPeriod(&systimer, BSP_ALARM_PERIOD); in the callback function but it didn't have any effect.

 

Please let me know what is the best way to make the periodic timer work even if the clock changes without restarting it.

 

Regards,

Priya

Outcomes