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

54 REPLIES 54
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
Super User

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
Super User

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 a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.
CAN Jammer an open source CAN bus hacking tool
CANableV3 Open Source

PPopo.1
Senior

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