Skip to main content
Associate
Jun 3, 2025 3:20 AM UTC
Solved

Interrupt callback only work when hitting debug break point

Hi, I was trying to implement timer interrupt on an ST32F407 Discovery board. The ST-Link on my board has been broken so I used an external ST-Link dongle and I have it connected by following this post:

https://electronics.stackexchange.com/questions/182763/how-to-use-an-external-st-link-v2-with-the-stm32f4-discovery-board 

I set up the timer so it will trigger interrupt once every 1s, but when I upload the code it does not go into interrupt. Only when I debug and put a break point in the callback function that it can execute the interrupt.

Here is a link to my code:

https://github.com/datcamap/DISCOVERYstm32.git 

Callback functionCallback function

 

This topic has been closed for replies.
TDK
TDKBest answer
Jun 3, 2025 3:31 AM UTC

Don't check the SR value. The callback is called when the update event happens. The update flag is already cleared when the function is called.

"If you feel a post has answered your question, please click ""Accept as Solution""."

2 replies

TDK
TDKBest answer
Jun 3, 2025 3:31 AM UTC

Don't check the SR value. The callback is called when the update event happens. The update flag is already cleared when the function is called.

"If you feel a post has answered your question, please click ""Accept as Solution""."
DataDAuthor
Associate
Jun 3, 2025 3:42 AM UTC

Thank you so much, this solved my problem.