1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

cpu/stm32_common: fix issue while clearing EXTI->PR reg

Since the "EXTI->PR" is an "rc_w1" type of register, we need to be
careful when clearing our interrupt flag in the register. When there
are multiple interrupt flags set in the register, the "|=" operation
will mistakenly clear all pending interrupts instead of just ours.
This commit is contained in:
Abdulkerim Altuntas 2020-05-18 16:41:23 +02:00
parent 87403c7d44
commit 578bd31908
2 changed files with 4 additions and 4 deletions

View File

@ -237,7 +237,7 @@ void rtc_init(void)
EXTI->FTSR &= ~(EXTI_FTSR_BIT);
EXTI->RTSR |= EXTI_RTSR_BIT;
EXTI->IMR |= EXTI_IMR_BIT;
EXTI->PR |= EXTI_PR_BIT;
EXTI->PR = EXTI_PR_BIT;
/* enable global RTC interrupt */
NVIC_EnableIRQ(IRQN);
}
@ -351,7 +351,7 @@ void ISR_NAME(void)
}
RTC->ISR &= ~RTC_ISR_ALRAF;
}
EXTI->PR |= EXTI_PR_BIT;
EXTI->PR = EXTI_PR_BIT; /* only clear the associated bit */
cortexm_isr_end();
}

View File

@ -115,7 +115,7 @@ void rtt_init(void)
!defined(CPU_FAM_STM32WB)
EXTI->FTSR_REG &= ~(EXTI_FTSR_BIT);
EXTI->RTSR_REG |= EXTI_RTSR_BIT;
EXTI->PR_REG |= EXTI_PR_BIT;
EXTI->PR_REG = EXTI_PR_BIT;
#endif
NVIC_EnableIRQ(LPTIM1_IRQn);
/* enable timer */
@ -206,7 +206,7 @@ void isr_lptim1(void)
LPTIM1->ICR = (LPTIM_ICR_ARRMCF | LPTIM_ICR_CMPMCF);
#if !defined(CPU_FAM_STM32L4) && !defined(CPU_FAM_STM32L0) && \
!defined(CPU_FAM_STM32WB)
EXTI->PR_REG |= EXTI_PR_BIT;
EXTI->PR_REG = EXTI_PR_BIT; /* only clear the associated bit */
#endif
cortexm_isr_end();