2024-06-23 08:08 AM
Hello, ST expert
STM32F407 is used for our custom design. And htim2 play the role of precise timing base.
When htim2->Instance.CNT = xx is used for setting a new counter start value for timer2, it seems that the new counter value does not functions immediately, I mean that the next counter value does not appear one clock period later.
Is there any timing diagram when TIMx_CNT register is written by user program?
BR
Yang
Solved! Go to Solution.
2024-06-24 04:32 AM - edited 2024-06-24 05:20 AM
@Tesla DeLorean do you remember the thread JW mentioned? I'd like to read it.
Update:
> but be aware of that that delta is off by an undocumented value (one or two cycles)
I wouldn't have expected it to be even that good, since the external signal is async to the STM32 clock domain. There has to be a synchronizer somewhere in the path (even if you were using an FPGA) and that is fundamentally non-deterministic. Any fixed (systematic) error can be compensated for, sometimes even for free (for example by tweaking some threshold constants in a conditional). If it's a couple of cycles it's usually not an issue.
In the stated application (GPS PPS) the external interrupt apparently has a nominal period of 1 second. So way way not an issue. Still good to know.
2024-06-24 01:58 PM