2023-01-10 09:42 AM
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.
2023-01-10 09:59 AM
Some interrupt firing and never returning, or continually firing and starving the main code of CPU cycles? If you halt execution, where is the CPU? This is in HAL_COMP_Init() waiting for the scaler bridge voltage to stabilize, right? Can you step into the while() loop and see the value decrement?
2023-01-10 10:07 AM
It could definitely be some interrupt firing and never returning, but when I halt execution I get error saying that the debugger doesn't know where I am in the code, thus I haven't been able to see what is doing the interrupting. It is waiting for the bridge voltage to stabilize, I can step through the while loop and it seems to go fine for at least the first few cycles but I don't want to sit at my computer hitting F6 5000 times to get through the loop.
2023-01-10 10:34 AM
And another quick edit, while I wasn't able to see where the code it was getting stuck I was still able to step the disassembly and it kept going back to a loop that started either at address 0x1fff_2171 or 0x1fff_225a, it's a little hard to tell because I'm just clicking through assembly code.
2023-01-10 02:10 PM
How is BOOT0 pin connected? How are the Option bytes set?
JW
2023-01-12 11:15 AM
The BOOT0 Pin was left floating on this version of the PCB, so I have nSWBOOT0 = 0 so that boot configuration is handled by the option bytes. nBOOT0 = 0 and nBOOT1 = 1 to when programming. I have also tried nSWBOOT0 = 1, nBOOT0 = 0, and nBOOT1 = 1 and was able to flash the program but any other combinations have been unable to flash the memory