2021-10-27 03:19 AM
I downloaded the blink LED demo from ST and loaded in that nucleo board to check out how things worked, soon I found out that every time when I pressed the "USER" Button (Connected to PE4), It won't be able to successfully switch to next blink pattern 100%, It sometimes would fail to switch over. I thought it maybe was a bad button issue but I debugged with IDE inserts a few breakpoint into the codes and I found some interesting behavior from the Interrupt Handler:
Related Code as follows:
NTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
#if defined(USE_STM8S_NUCLEO_64)
if(BlinkSpeed == 3)
{
BlinkSpeed = 0;
}
else
{
BlinkSpeed ++;
}
#endif /* USE_STM8S_NUCLEO_64 */
}
It just a simple code for switching modes, If I insert breakpoints in line 7,9 and 10 and execute line by line in debug mode, it work out perfectly, switching blink pattern every time I pressed the button. But if I take off all the breakpoints or when 7 or 9 then it will start acting glitchy. What caused this issue and how to solve this?