2021-10-08 06:31 AM
Hello everyone,
I write HAL_Delay(1000) or HAL_Delay(5000) on my code but it delays it by half. I checked SystickTimer it works fine. But HAL_Delay function gives me half delay time.
I created another project with same board, same Cubemx features , it works fine.
Where should i check at my code to find what's wrong with it (at debug mode)?
Solved! Go to Solution.
2021-10-09 12:48 AM
Why i did that i don't know but I had written twice HAL_IncTick(); function in the SysTick_Handler.
My stupidity I'm sorry.
It's solved.
Thank you all.
2021-10-08 06:46 AM
What are you using for a clock source, and on what board?
For external clocks watch the define for HSE_VALUE, and use of HSE BYPASS for TCXO/XO type clock sources vs crystals
Internal clocks can typically be exported via MCO/PA8 pin so you can scope them.
2021-10-08 06:55 AM
I am using HSI16, at PLL x4 and /2 32MHz all of the peripherals. Also I have a HSE osc. But situation is same. HAL_Delay gives me delay by half.
MCO is used as a input right now but i'll try tomorrow.
2021-10-08 07:14 AM
HAL_Delay uses SysTick to increment the counter. Can't see how one would be correct and the other would be wrong. The logic is very simple.
Most likely the clock is twice as fast as you think it is.
2021-10-09 12:48 AM
Why i did that i don't know but I had written twice HAL_IncTick(); function in the SysTick_Handler.
My stupidity I'm sorry.
It's solved.
Thank you all.
2021-10-13 10:57 AM
Thanks for the update on that. That would certainly do it..