AnsweredAssumed Answered

EXTI->PR Manual vs Snippets

Question asked by giesel.thomas on Oct 22, 2015
Latest reply on Oct 23, 2015 by waclawek.jan
The STML0 (and L1) manual says following about the register EXTI_PR:
"1: The selected trigger request occurred. This bit is set when the selected edge event arrives on the interrupt line. This bit is cleared by writing it to 1 or by changing the sensitivity of the edge detector."

The bits are of type rc_w1, which corresponds to the description.

But the Code Snippets (e.g., stm32snippetsl0\STM32L0xx_Snippets_Package_V1.1.1/Projects/RTC/02_ProgrammingTheWakeUpTimer/main.c) use following code:

EXTI->PR |= EXTI_PR_PR20; /* clear exti line 20 flag */

This does "Take all bits that are set in this register, set one more (even though it is usually set already at this place) and write it back". And that translates to "Clear all pending EXTI lines", which is not the intention. It may clear additional, unwanted lines.

Shouldn't the line be as follows, considering rc_w1?
EXTI->PR = EXTI_PR_PR20; /* clear exti line 20 flag */

Outcomes