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
AScha.3
Chief II

where you call hal-delay? in INT ? you give all ints same (highest) priority 0 , so Systick cannot be called from same level. -> set tim2 2 , i2c..3 or so.

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

I call it in main function. I will try setting priority and will get back to you

PPopo.1
Senior


_legacyfs_online_stmicro_images_0693W00000biApFQAU.pngI changed it like so and it still gets stuck at HAL_delay(10);

AScha.3
Chief II

ok, in main should be no problem anyway.

try: not jump in/on hal-delay() , set cursor one or more lines after the line with delay and use run -> run to line

 

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

Cant even run the program that way. But when I debugg it doesn't go past the delay

AScha.3
Chief II

just..why not use the hse ?? (and pllm /2)


_legacyfs_online_stmicro_images_0693W00000biArQQAU.png+

is program running when just run/start in debug? (and stop with suspend/pause )

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

I tried it with hsi, still not working. Yes, it seems like its running fine but cant really check because the live expression values are not showing for some reason. Also, do I need to do anything in the code to enable delay? I havent done anything, just tried to use it with hal_delay()

AScha.3
Chief II

HAL_Delay(310); -- should just work. (but not: HAL_delay(10); ! d -> D !

if you have correct function call, just go in editor on the word with mouse cursor, you see in popup window the definition. if nothing shows up - wrong.

see on compile also every warning !!! only zero is good ->

<<15:23:20 Build Finished. 0 errors, 0 warnings. (took 3s.872ms) >>

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


_legacyfs_online_stmicro_images_0693W00000biAsxQAE.pngThere is a declaration but it has been autogenerated, i didnt do it. I also have 9 warrning but only for unused variables later in the code. I tried 310 and also hal_delay(350), nothing works