0

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?

ocrdu
  • 8,705
  • 21
  • 30
  • 42
Jack Frye
  • 145
  • 3
  • 1
    Did you use MX to set up the clocks and initialize GPIO (including related clocks)? – Spehro Pefhany Jan 24 '23 at 02:38
  • 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. – brhans Jan 24 '23 at 03:27
  • Yes, I used MX inside of STM32CubeIDE – Jack Frye Jan 25 '23 at 01:07

0 Answers0