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

I tried that, also created whole new workspace not just the project. Will try with another STM32 when I get home

Karl Yamashita
Lead III

Upload the schematic

If smoke escapes your device, put the smoke back in. It'll still work as a conversation piece. If you find my answers useful, click the Accept as Solution button so that way others can see the solution.

There you go sir

Can you share your code or IOC file?

I think yo need to set your Trigger event if you want TIM2 for something


_legacyfs_online_stmicro_images_0693W00000biIqLQAU.png 

i could not replicated your issue

I set it to TIM7 where trigger is not needed.

Ok, sorry i can not replicated it. Can i ask why you want to use HAL_Delay()? i think timer functions are a better solution.

I will use timer functions and interupts now but it just bothers me that HAL_Delay() is not working when it should. I mostly need it to wait for temperature conversion with SPI communication which takes around 10ms

Can you use DMA with GPIO_Callback, for SPI communication while you procces the conversion. BTW i looked at conversion function, try no to do a oneliner when you can use more for readability