I have a breakpoint in the interrupt, but when i debug this point, the scope does not show the signal (red) as expected.It should be high and not low, as you can see in the picture.
No stop bits are set. Only DGB_SLEEP, DGB_STOP and DGB_STANDBY.
Why would it stop, and then take 30ms to get into the interrupt? That is a long time, also for debugging i would say. Then debugging would not really work on this point, as there is stuff beeing executed 30ms away, form where it should have happend.
The red signal shows the interrupt activity (high for inside of interrupt).
The program (debugger?) does stay out of the interrupt for 30ms (read from scale of scope) when it should not (green line is input for interrupt).
Now i have attached another picture:
The program stays outside of interrupt for 30ms, but then fires one interrupt, leaves the interrupt, but then goes back into it again and stops at the breakpoint.
> The program (debugger?) does stay out of the interrupt for 30ms (read from scale of scope) when it should not (green line is input for interrupt).
OK so you have some program - e.g. interrupt with higher or same priority as the interrupt in question - which lasts 30ms under some circumstances.
Or, if you've just clicked breakpoint in the debugger at that moment, it might've been that the debugger stopped execution for 30ms so that it could insert the breakpoint.
ie #define CLEAR_BIT( REG, BIT ) ((REG) &= ~(BIT))
TIM->SR = ~1; // A simple write to clear UPDATE source
Using RMW has secondary effects, including a race condition that can cause you to miss other interrupts that pend in the 8+ APB cycles that's going to take.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
~ in C is bitwise NOT, i.e. it inverts all the bits of given word.
~1 thus is 0xFFFF'FFFE.
The above notation clears TIMx_SR.UIF. Read TIMx_SR bits description in the RM; also the meaning of abbreviations which are next to the register bits such as rc_w0, they are given at the very beginning of the RM.
A writeup why you should not use RMW (Read-Modify-Write) operations to clear TIMx_SR here.