Skip to main content
Associate III
April 13, 2024
Question

RTC or timer?

  • April 13, 2024
  • 2 replies
  • 1953 views

Hello everyone,

In my project on STM32 Nucleo-64 with STM32F401RE MCU, I use a timer (TIM11) at 32 Hz in interrupt mode to get some data from sensors.  

Can I use the RTC (Real-Time Clock) instead of TIM11 to get these data at the same frequency?
If yes, which are the advantages or disadvantages?

 
 

2 replies

AScha.3
Super User
April 13, 2024

Hi,

Now it's working fine with Tim 11 - why use other timers then? Same interrupt to call - just other name. And look, whether RTC can do at this speed, it's more a clock than a general timer.

So I see nothing useful to change the timer.

"If you feel a post has answered your question, please click ""Accept as Solution""."
ST Employee
April 15, 2024

Hello @thetectivestm

>>Can I use the RTC (Real-Time Clock) instead of TIM11 to get these data at the same frequency?

it is possible but as @AScha.3 mentioned, we can't see the usefulness, timers are more flexible, precise and can be easily configured for a wide range of frequencies and modes. 

The RTC is typically clocked by a 32.768 kHz crystal, which might not provide the same level of precision as a timer.

Power-wise, timers typically consume more power than the RTC, so maybe you should explain more tour your project's specific requirement, if power consumption is critical and the slight loss in precision is acceptable, the RTC might be the better choice. But if you need higher precision and have no stringent power constraints, sticking with TIM11 could be more appropriate.

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.