Skip to main content
OVACH.1
Associate
July 8, 2021
Question

Is it possible to set the internal timer (not in accordance with reality) of the STM32 board (NUCLEO-F401-RE)?

  • July 8, 2021
  • 3 replies
  • 832 views

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?

This topic has been closed for replies.

3 replies

TDK
July 8, 2021

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.

"If you feel a post has answered your question, please click ""Accept as Solution""."
OVACH.1
OVACH.1Author
Associate
July 8, 2021

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);

waclawek.jan
Super User
July 8, 2021

Then resort to the documentation to Arduino, or any Arduino forum, to find out, whether the primary clock source is HSI or HSE.

JW