Skip to main content
Fidk.1
Associate
December 27, 2022
Question

how does one get time intervals on an stm32f10 using the standard libraries?

  • December 27, 2022
  • 2 replies
  • 1826 views

..

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
December 27, 2022

What do you mean by "get time intervals"?

Are you aware of the fact that SPL has been superseded by Cube years ago?

JW

Fidk.1
Fidk.1Author
Associate
December 28, 2022

save the current time, wait, then subtract it from the new current time to get the time of something

Tesla DeLorean
Guru
December 27, 2022

Just enable the SysTick for 1ms (1000 Hz), and have a SysTick_Handler to increment a tick variable, perhaps also a local time/date clock

Or configure a TIM in maximal / free-run, say divided to 1 MHz, so you can delta time in micro-seconds, range about 65 ms via TIMx->CNT

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Fidk.1
Fidk.1Author
Associate
December 28, 2022

I am not using the cube ide since I'm editing code that has been written and is compiled without it, so I am not sure as to how to do this

Tesla DeLorean
Guru
December 28, 2022

I'm not using CubeIDE either..

I'm not in a position to know your level of technical skill, education or training. Perhaps provide some context to understand what other experience you have. I need something to pivot off.

Perhaps get a programming manual for the Cortex-M3 more generally, the SysTick works on all these types of MCU exactly the same. Joseph Yiu has a good series of books.

STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\SysTick\TimeBase

https://www.st.com/resource/en/programming_manual/pm0056-stm32f10xxx20xxx21xxxl1xxxx-cortexm3-programming-manual-stmicroelectronics.pdf

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..