cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F405 interrupts don't fire

THenr.2
Associate II

Hello,

I'm encouring one problem with STM32F405 interrupts.

I'm working on a project that using a MCU STM32F405,

I have created a CubeMx Projet, set all the clock (input frequency, Sysclck, APB1, ...), set timer2, CAN2 and UART2. I have set enable TIM2 global interrupt in TIM2 Configuration and also Set enable USART2 global interrupt in NVIC Settings tab.

I use VsCode to code and debug in the STM32F405. My program seems to work perfectly, I can blink some Led. But usart, can and timer interrupt don't fire!

Breakpoint in SysTick_Handler works, so it seems that interrupt works, but breakpoints in timer never fire.

I think that may be the debugger have trouble, so I have tried to blink a led with the timer and of course that doesn't work.

In the past I had used CubMx and STM32 MCU for other project without trouble about interrupts.

Thanks

4 REPLIES 4
THenr.2
Associate II

I forgot to mention that I using STM32CubeMX 4.25.1 on Win10.

Could you please help me to get interrupt works.

Check the vector table and linkage to your routines.

If using .CPP files or C++ remember that it mangles names and breaks C linkage.

Review .MAP and disassemblies.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
THenr.2
Associate II

Hi Clive,

Thanks to take time to answer to my question.

Flash is at common addres for a STM32F4:

FLASH starts at 0x8000000, which include interrupt?

.MAP Address seems to be ok, but I really don't know if it is good address, I'm not used to modify or check this kind of file

.text.SysTick_Handler
 
               0x08000d2c       0xc build/stm32f4xx_it.o
 
               0x08000d2c               SysTick_Handler
 
 .text.TIM2_IRQHandler
 
               0x08000d38      0x10 build/stm32f4xx_it.o
 
               0x08000d38               TIM2_IRQHandler
 
 .text.USART2_IRQHandler
 
               0x08000d48      0x10 build/stm32f4xx_it.o
 
               0x08000d48               USART2_IRQHandler

Everything looks good but interrupt is not firing (exept systick irq)

The vector table is a list of 32-bit addresses and takes up the first few hundreds of bytes of the image at 0x08000000

You need to confirm the entries of interest (the interrupts you're firing) go to the routines you expect.

You'll then want to confirm the interrupt is enabled in the NVIC, and within the peripherals. You'll want to dump out or inspect all registers in the chain, end-to-end.

You want to determine if the routines are entered/exited, you can use breakpoints, or preferably GPIO you can set high/low and scope.

If you don't properly clear/service an enabled interrupt, you'll get a storm, and it will keep entering over and over. ie you enable USART TXE, and don't give it any data.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..