File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -290,13 +290,22 @@ condition and generating hardware reset or using Go command to execute user code
290
290
HAL_RCC_DeInit ();
291
291
HAL_DeInit ();
292
292
293
- // disable all interupts
294
- __disable_irq ();
293
+ // Disable all pending interrupts using NVIC
294
+ for (uint8_t i = 0 ; i < MP_ARRAY_SIZE (NVIC -> ICER ); ++ i ) {
295
+ NVIC -> ICER [i ] = 0xFFFFFFFF ;
296
+ }
295
297
296
- // Clear all pending interrupts
297
- for (uint8_t i = 0 ; i < (sizeof (NVIC -> ICPR ) / NVIC -> ICPR [0 ]); ++ i ) {
298
+ // if it is necessary to ensure an interrupt will not be triggered after disabling it in the NVIC,
299
+ // add a DSB instruction and then an ISB instruction. (ARM Cortex™-M Programming Guide to
300
+ // Memory Barrier Instructions, 4.6 Disabling Interrupts using NVIC)
301
+ __DSB ();
302
+ __ISB ();
303
+
304
+ // Clear all pending interrupts using NVIC
305
+ for (uint8_t i = 0 ; i < MP_ARRAY_SIZE (NVIC -> ICPR ); ++ i ) {
298
306
NVIC -> ICPR [i ] = 0xFFFFFFFF ;
299
307
}
308
+
300
309
// information about jump addresses has been taken from STM AN2606.
301
310
#if defined(STM32F4 )
302
311
__set_MSP (* ((uint32_t * )0x1FFF0000 ));
You can’t perform that action at this time.
0 commit comments