When setting or clearing NVIC Interrupts without library functions the |= operator doesnt work. When I used it, all other interrupts were cleared.
The stm32F103 Datasheet says that the actual enable state can be read from both ICER or ISER register.
Doesnt work: (IR29 just an example):
NVIC->ICER[0] |= (1UL << 29) // Disables all other interrupts too !!
.
Writing with = operator works:
NVIC->ICER[0] = (1UL << 29) // Disables only Interrupt 29
Keil uvision 4.71.2.0
It won't work. The register is NOT supposed to be used like that!
You are expected to WRITE ONES to bits that you want to be cleared. If you use the |= operator then you're reading and writing. It does not make sense.
This is absolutely nothing to do with Keil, it's the ARM core and it would do the same if used with any compiler.
Hello Henry,
To make your life simpler you can use the helper functions that are part of CMSIS
In C:\Keil_v5\ARM\CMSIS\Include\core_cm3.h
There is the NVIC_DisableIRQ() function. As you noticed, it does not use a |= statement to change the value of the register.
Read more about this function at:
www.keil.com/.../group__NVIC__gr.html
For reference you can read about the ICER register here:
developer.arm.com/.../interrupt-clear-enable-registers