I want to improve the accuracy of the microcontroller's tick.
Hi.
The cause of the issue being inquired about below might be due to tick precision, so I am making an additional post
In my system, the microcontroller and the counterpart device are sending and receiving TCP/UDP packets at a 20ms interval.
The microcontroller uses osDelayUntil() and the counterpart uses ROS2's Timer to perform processing at 20ms intervals.
However, when checking the tcpdump on the counterpart device,
the interval between packets received from the microcontroller is slightly shorter than 20ms,
and the reception time gradually becomes earlier than expected by 1ms, 2ms, and so on.
(The pace increases by 1ms every 40s.)
If the accuracy of the microcontroller's tick is improved,
the tick progression will be synchronized with the counterpart device,
and the discrepancy in the reception time will be eliminated.
How can the accuracy of the microcontroller's tick be improved?
I tried changing each of the following IOC file settings one by one, but the issue was not resolved.
Pinout & Configuration
・Timebase Source:TIM5 → TIM1
Clock Configuration
・HCLK(MHz):168 → 216
・PLL Source Mux:HSE → HSI
Test environment:
Microcontroller : STM32 NUCLEO-F767ZI
Counterpart device : Ubuntu 22.04, ROS2 (C++)
STM32Cube IDE : 1.15.0
STM32 Firmware : STM32_Cube FW_F7 V1.17.1
STM32Cube MX : 6.11.0
Best regards.
