cancel
Showing results for 
Search instead for 
Did you mean: 

hal_delay() not working

PPopo.1
Senior

So I've created a project and am trying to use the HAL_delay(10); but it gets stuck at this function when im trying to debug.

I have been changing the clock and enabling the TIM2 so I don't know if i've messed something up. Here are the settings that I have:


_legacyfs_online_stmicro_images_0693W00000biAmBQAU.png
_legacyfs_online_stmicro_images_0693W00000biAmGQAU.png
_legacyfs_online_stmicro_images_0693W00000biAmVQAU.png
_legacyfs_online_stmicro_images_0693W00000biAmaQAE.png
_legacyfs_online_stmicro_images_0693W00000biAmfQAE.png 

And that is about it

52 REPLIES 52
PPopo.1
Senior

could be some issue with HAL_GetTick?

PPopo.1
Senior

so this is the inside debug of delay:


_legacyfs_online_stmicro_images_0693W00000biAu0QAE.pngit gets stuck at this while

Make sure SysTick_Handler() is calling HAL_IncTick(), that it's not weak, and that it is binding into the image.

Double check SCB->VTOR pointer to your Vector Table address, and that the interrupts aren't disabled.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
AScha.3
Chief II

seems: sysclk not running ...because tickstart should not stay at 0.

should be so: (> 0)


_legacyfs_online_stmicro_images_0693W00000biAuUQAU.png

If you feel a post has answered your question, please click "Accept as Solution".

ok so this is systick:
_legacyfs_online_stmicro_images_0693W00000biAvNQAU.pngand this is hal_gettick


_legacyfs_online_stmicro_images_0693W00000biAvhQAE.png

AScha.3
Chief II

and in ***_it.c file you should have :


_legacyfs_online_stmicro_images_0693W00000biAvm.png

If you feel a post has answered your question, please click "Accept as Solution".

any idea how do i fix that ?

I tried creating a new projectg without any setup changes and tried running HAL_Delay(300); and it also got stuck

upload this project

If you find my answers useful, click the accept button so that way others can see the solution.
PPopo.1
Senior

So basically I am trying to read 3 sensors, two with SPI and one with I2C.