cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429VGTx program works while running but not in debug session

DCruc.11
Associate

Hi everybody,

I'm working with a STM32F429VGTx MCU and I just wanted to test a simple Toggle LED program with it, but I'm having trubble when debugging the project.

I'm using CubeMX to configure the PE2 pin as GPIO output and I'm also setting up the HSE crystal resonator as the external clock for the system clock. In the clock configuration I'm setting up HCLK to be 180 MHz and I'm not sure if this is relevant, but I have also configured by debug as JTAG with 5 pins under the "SYS" menu.

After generating the code for SW4STM32 I have only added the HAL_GPIO_TogglePin() function and a delay to watch the LED blink. My project compiles perfectly and it also runs just fine. The problem comes when starting a debug session.

I add a breakpoint right before the HAL_GPIO_TogglePin() function and the debugger frezees inside the SystemClock_Config(void) function. If I click the "Suspend" buttom and then "Reset the chip and restart the debug session", the debug works perfectly. If I use the F6/F5 keys I can see that the systems enter the error handler after evaluating the HAL_RCC_OscConfig(&RCC_OscInitStruct) function.

I'm not sure if this has to be related to the way the timers are being stopped while adding the breakpoints or if there is a problem with the external clock configuration. However, getting this first-debug-problem makes me wonder about the stability of the rest of my project.

Thanks in advance!

UPDATE: I generated the same code for STM32CubeIDE and this time the program works perfectly and I can debug as always. Any idea why? What is the difference between the debugger in both IDEs?

0 REPLIES 0