2021-07-08 07:41 AM
Hello, I am using an STM32 board (NUCLEO-F401-RE) and a ToF sensor for a project of measuring a passing vehicle flow. My system must be autonomous, I use a timer in my program to know the flow of passage. Only the timer does not conform to reality. When I let 1 minute pass (with my cell phone) my card tells me that 55 seconds have passed. And the more time I leave, the greater the difference. Do you know if it is possible to adjust the timer on the board? Or a simple update?
2021-07-08 07:58 AM
It depends on what you're using as a clock source. If you're using the HSI clock, you can use the HSITRIM values to alter it slightly. There is no such setting for HSE.
However, an error of almost 10% (5/60) is way outside of specifications, so maybe there's a software bug here causing the issue.
2021-07-08 08:16 AM
Sorry I'm a beginner in programming ...
I don't know if I used HSI or HSE clock but I defined and used it like this (in Arduino IDE):
unsigned long temps_ms;
temps_ms=millis();
EEPROM.put(address+4, temps_ms);
2021-07-08 10:16 AM
Then resort to the documentation to Arduino, or any Arduino forum, to find out, whether the primary clock source is HSI or HSE.
JW