0
\$\begingroup\$

I have a project using ARM Cortex M4 with scaling CPU frequencies dependent on the workload. I would like to use the WWDG because it allows a lot more options like interrupt on watchdog. Question is: is there any standard workaround for variable time length CPU tick?

\$\endgroup\$
  • 2
    \$\begingroup\$ I don't even see the problem you need a workaround for \$\endgroup\$ – PlasmaHH May 31 '16 at 8:54
  • 1
    \$\begingroup\$ That design sounds plain wrong and dangerous. Instead, why don't you use one fixed CPU frequency and use a sleep mode when you need to save power? \$\endgroup\$ – Lundin May 31 '16 at 8:56
1
\$\begingroup\$

I am not familiar with the particular "windowed watch dog" peripheral you mentioned, or where it gets its clock from. Its possible that the WD may run from something like a real-time clock (RTC) 32.768 KHz clock source, and would thus be independent of the processor frequency. Regardless, there should be some way to calibrate the amount of time that the WD timer counts before interrupting/resetting. You could use this to adjust the time based on the current clock frequency. To make this easier, why not write a single function responsible for both changing clock frequency and updating the WD timer values based on the new frequency.

If the WD gets its clock source from the SysTick timer built into the CM4, then check out the SysTick registers for how to change the count values: ARM InfoCenter Doc on SysTick

A lot of this is device dependent, so you will need to consult the manufacturer's documentation for your specific device. It should give you some guidance.

(I am assuming that you are using clock divider circuitry on board the processor for changing frequency. Despite the previous commenter, there is nothing wrong with this. It's a standard way of reducing power. Now, if you were actually changing the clock frequency that you fed into the part, that WOULD be a bad idea, most likely.)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.