0
\$\begingroup\$

I am programming my STM32F030FPx TSSOP20 over SWD. I am simply trying to blink an LED by using the HAL GPIO library and the system timer to setup a delay. When I begin debug and let the program run, it crashes every time.

At first, I thought it was crashing due to a call to HAL_Delay, so I removed that and opted for a counter. I simply want a delay before and after toggling the LED pin.

My main loop only contains

while (1)
{
  HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
  while (i < 100)
  {
    i = i + 1;
  }
  i = 0;
}

I started with a number way larger than 100 but tuned it down just to make sure it got through when I used the debugger to step through. I don't think it can get much simpler than this. I am able to step through the loop 100 times and get the LED to toggle back off after I turn it on through the first pass through the while loop. However, when I do not step through manually with the debugger, the program crashes and this is what the IDE presents.

enter image description here

I am not sure how to interpret what is going on. Is there a problem with the dependencies I might be using? What is <signal_handler_called>() meant to indicate? Which signal is being handled?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Did you use MX to set up the clocks and initialize GPIO (including related clocks)? \$\endgroup\$ Jan 24, 2023 at 2:38
  • \$\begingroup\$ Looks like a HardFault (or a BusFault which got elevated into one), the most likely cause being what Spehro mentioned above - you probably haven't configured your system clocks, and as a result trying to access the GPIOA module produces a fault. \$\endgroup\$
    – brhans
    Jan 24, 2023 at 3:27
  • \$\begingroup\$ Yes, I used MX inside of STM32CubeIDE \$\endgroup\$
    – Jack Frye
    Jan 25, 2023 at 1:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.