2015-12-07 12:27 AM
Hi All,
Attempting to clear a pending bit in the EXTI_PR1 register via its bit banding alias clears another pending bit as well. When I try to clear the bit20 (RTC periodic alarm) after wakeup by writing 1 to its alias address 0x422082d0 also clears bit5. This behaviour is may be specific to wakeup or RTC alarm interrupt. I havent tested if it clears all bits or some bits. Or it happens only after wakeup.What I observed though when I clear the bit20 via its direct address, i.e., ''EXTI_PR=1u<<20; '' it only clears bit20.Any ideas or similar experiences?ThanksKerem #stm32l4762015-12-07 03:04 AM
This is expected behaviour. Bit-banding from the point of view of the memories and peripherals is read-modify-write, whereas the EXTI_PR1 register's bits are rc_w1 i.e. cleared by writing 1.
Thus, you ought to clear Nth bit by writing 1<<N directly into the register. JW2015-12-07 05:39 AM
Bit banding has long standing, and long documented, issues with accessing peripheral space, especially when the hw has been designed to avoid race hazards.
TIMx->SR = ~1; being a classic example Until such times as a RMW is faster than a simple Write the point of using bit-banding on these peripherals is hard to make.2015-12-07 07:07 AM
Thanks for the clarification. Modified the code accordingly.