STM32L412 | How to fix MCU getting hung up in HAL peripheral init functions
While in debug mode if I step through the HAL init functions (the first one I have trouble with is COMP1_Init()) I get stuck in a loop that does nothing but decrement a counter. There is no timer associated with the loop it just looks like a while(timeout) { timeout--;}. I have a breakpoint before and after so I know that the loop is where I get stuck. If I hit run at the beginning of the program I get to the breakpoint before the loop, but when I hit run again I never reach the post-loop breakpoint. Any suggestions would be appreciated. I found a couple of forum posts with a similar issue but they were all fixed by cycling power. I have tried cycling power, restarting my IDE, restarting my debugger, with no luck.
Thanks in advance for the help!
EDIT 1:
After doing more debugging it seems that there are a few more problems, any time something calls the HAL_Delay() function it also hangs up but if I manually step through the function it is fine, maybe there is something in the debug configuration that could affect this but I haven't found it yet. I have a similar problem when starting TIM1. I am able to initialize it with no issues but when I call HAL_TIM_Base_Start_IT() it gets hung up if I try to step over it but if I step into it then it works just fine.
