2020-07-23 03:42 AM
I have built my own custom board with an STM32L412KB processor on board. I am using the ST-link /v2 to connect via JTAG to the board. I am able to connect with the ST-Link utility as well as Keil. In Keil I can compile and flash the code, but it seems there is some sort of problem.
I am able to enter debug mode, but if I put a breakpoint within the main function and click 'run to cursor', it gets stuck and the ST-Link flashes red/green indefinitely. However, in debug mode I can open the registers manually and change values (e.g. to make LEDs turn on/off etc).
Any advice or thoughts would be greatly appreciated as I am at a loss for what to do.
Thanks!
2020-07-23 03:59 AM
Where does it get stuck, hit the stop button and check.
Is it in the Error_Handler or HardFault_Handler while loops? A BKPT because you're using puts/printf?
2020-07-23 04:09 AM
Thanks for replying. My main program is just one line:
int main(void){
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOHEN;
return 0;
}
In debug mode when I press 'stop', I see things happening in the registers and disassembly when I step by one line. I am not sure how I would tell if this is from the Error_Handler or HardFault_Handler.
Here are some screenshots:
2020-07-23 08:03 AM
To follow up I believe it's just a problem with the program getting hung up in the startup code and never reaching the main program for some reason.