Showing results for 
Search instead for 
Did you mean: 

hal_delay() not working


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:


And that is about it


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

Karl Yamashita
Lead II

Upload the schematic

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


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