I stopped in the middle of debugging a very simple project where I send "hello world\r\n" every couple seconds out of USART2. The first print hits the console and then I hang in an infinite loop after in startup_stm32.s
:
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
*
* @param None
* @retval : None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
I appear to not be handling an interrupt, but I myself actually have not enabled any interrupts. I am only using the HAL_UART_*
API (HAL_UART_Init
, HAL_UART_Transmit
, and implemented the HAL_UART_ErrorCallback
).
Best Answer
You can add a new handler with an infinite loop one at a time until the missing IRQ handler is detected. It's a slow, but reliable method. You can find the full list of weak IRQ definitions in the
startup_stm32.s
file.Example incremental IRQ handler addition to
stm32f3xx_it.c
:In general, this seems to be an issue of unknown defaults. Starting a project with all the IRQ handlers implemented is one way to make sure you're not bitten.