STM32F4 program crashes when interrupt is activated
Hello,
I wrote a program for the STM32F4 using the Standard Peripheral library from ST. I compile the source code with the ARM-GCC tool chain and flash it on the chip using OpenOCD in combination with gdb. As long as I do not use interrupts everything works fine. But now I want to use Timer interrupts. I activate them according to the Standard Peripheral manual, i.e I configure the NVIC with the commands:
NVIC_InitTypeDef nvicStruct;
nvicStruct.NVIC_IRQChannel = TIM1_UP_TIM10_IRQn;
nvicStruct.NVIC_IRQChannelPreemptionPriority = 0;
nvicStruct.NVIC_IRQChannelSubPriority = 1;
nvicStruct.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&nvicStruct);Then I am activating the Timer interrupt:
TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE);But as soon as the above line is executed, in GDB a message is popping up which says:
Program received signal SIGTRAP, Trace/breakpoint trap.
0x08020388 in ?? ()
The program does not react anymore to commands from GDB. Trying to step forward just results in a
Cannot find bounds of current function
messages. The exact same is happening when I do activate the Timer interrupts first and the NVIC configuration second. Then the GDB error message is appearing after
NVIC_Init(&nvicStruct);What could be the reason for this error? I have the theory, that the MCU is somehow jumping to the wrong address, during an interrupt.
Every help is greatly appreciated.