Try to implement an atomtic operation to avoid a specific interrupt generated by GPIOB GPIO_PIN_8 . If using the code as below, it works.HAL_NVIC_DisableIRQ(EXTI9_5_IRQn); //atomtic operationHAL_NVIC_EnableIRQ(EXTI9_5_IRQn); But tried the code as...