2024-05-09 05:26 AM
I have a strange problem. I have a global uint32_t variable that counts up in the main loop and every 100 ms it gets reset in a timer-ISR. This works, but sometimes it does not.
Here is the value of the variable MainCounter read out by the debugger:
The ISR is definitely called every time as the toggling variable test shows. Also inside the ISR MainCounter really is zero, I checked. But sometimes this zero does not "reach" the main loop.
Please help, I have absolutely no idea how this is even possible.
Solved! Go to Solution.
2024-05-10 10:51 AM
This has nothing to do with it being a dual core CPU. This problem exists one single core CPUs as well.
btw, I solved it now with a reset flag. This was the fastest solution.
if (ResetMainCounterFlag) {
ResetMainCounterFlag = false;
MainCounter = 0;
} else MainCounter++;