2021-06-08 02:48 PM
I am trying to port some Arduino library to stm32. In Arduino,
millis()
returns the number of milliseconds since boot. Is there an equivalent function in stm32? I am using stm32f103 MCU.
Solved! Go to Solution.
2021-06-08 03:53 PM
HAL_GetTicks () should suffice, typically a 1ms tick via SysTick
2021-06-08 03:41 PM
No, there's not. You can roll your own using a timer or the DWT counter, but be aware both of these can roll over.
2021-06-08 03:53 PM
HAL_GetTicks () should suffice, typically a 1ms tick via SysTick
2021-06-09 12:39 AM
Thanks for your feedback. How can I use the DWT counter? I just want to see the running time of the mcu.
2021-06-09 06:42 AM
2022-02-26 07:47 AM
The uint64_t variable is so big that it really never overflows.
2022-08-05 03:19 AM
HAL_GetTicks ()
is useful.
I just tested in stm32L475.
Its working.
I am getting 1001 count for delay of 1000 milliseconds.