cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_Delay() function always last 1 ms more

sergetr
Associate II
Posted on October 19, 2017 at 14:11

I'm using the latest build of CubeMX with a F429 Disco kit. If I use HAL_Delay(1) it last 2 ms, HAL_Delay(5) last 6 ms to get 1ms HAL_Delay(0) must be used.

This is a major bug that should be fix ASAP!

2 REPLIES 2
Posted on October 19, 2017 at 15:01

Don't rely on these routines for precision timing, the granularity is already poor, try a time base that clocks 10x the resolution you want. Consider using DWT_CYCCNT, that has ~5ns granularity, and might deliver +/-20ns accuracy.

>>

This is a major bug that should be fix ASAP!

No, you're using a function that's inappropriate for your application.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on October 19, 2017 at 15:27

Loopdelays are usually meant as 'delay at least as much as the argument says'.

The documentation should clearly state this - did you check it?

JW