This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Clear or Set NVIC Interrupts with NVIC->ICER[0] and ISER[0] causes error

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

Parents
  • 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.

Reply
  • 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.

Children
No data