Skip to main content
Fidk.1
Associate
Dec 27, 2022 9:38 PM UTC
Question

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

..

This topic has been closed for replies.

6 replies

waclawek.jan
Super User
Dec 27, 2022 10:42 PM UTC

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
Dec 28, 2022 8:45 AM UTC

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

Tesla DeLorean
Guru
Dec 27, 2022 11:00 PM UTC

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 Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Fidk.1
Fidk.1Author
Associate
Dec 28, 2022 8:47 AM UTC

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
Dec 28, 2022 5:36 PM UTC

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 Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..