2021-03-29 04:34 AM
Hi,
I am using STM32L4S5ZI which has only a timer with maximum capacity of 32-bit. The DWT(Data Watchpoint Trigger) is somehow not available because when I check for DWT->CNT it always shows 0. So I needed a 64-bit timer for my application which keeps on running and I can read it whenever I need the time.
Is there any way by means of which I can somehow use the 2 32-bit timers available and make them together as a single 64-bit timer?
I do not want to use the Period_elapsed interrupt and keep track of the overflown time. So please let me know if I have any other way possible..
Thanks
2021-03-29 04:46 AM
Somewhere I read about chaining two timers, like chaining two 32 bit timers to 64 bit timer. But there was no clear explanation.
If anyone can throw some light on this then it would be really helpful.
2021-03-29 03:09 PM
Run some timer that you sample faster than half the timer period. When you sample, compare to the last sample and when new sample is smaller than last sample, increment some variable to generate the missing bits to 64 bit. When you need to use the combined value do the same sampling. Make sure you both actions do not step on the others feet.
2021-03-29 05:21 PM
Yes, you'd chain TIM2 TIM5 in a gated mode, I don't have an example to hand for the L4, but there are likely examples for the other STM32 families using paired 16-bit timer that would morph similarly to a pair of 32-bit ones and also in ST's TIM Cookbook
2021-04-02 02:33 AM
> The DWT(Data Watchpoint Trigger) is somehow not available because when I check for DWT->CNT it always shows 0.
You have to enable it!