From d372f913efb84b2303aff9906caeed44d9b37069 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 14 Dec 2022 09:53:06 -0500 Subject: [PATCH] stm32: Don't use read-modify-write on ISR register in stm32h7_adc.c Bits are cleared in the ISR register by writing 1, not by masking. Signed-off-by: Kevin O'Connor --- src/stm32/stm32h7_adc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/stm32/stm32h7_adc.c b/src/stm32/stm32h7_adc.c index ddec7d88..b9e14916 100644 --- a/src/stm32/stm32h7_adc.c +++ b/src/stm32/stm32h7_adc.c @@ -237,11 +237,10 @@ gpio_adc_setup(uint32_t pin) ; // Enable ADC - // "Clear the ADRDY bit in the ADC_ISR register by writing ‘1’" - adc->ISR |= ADC_ISR_ADRDY; + adc->ISR = ADC_ISR_ADRDY; adc->ISR; // Dummy read to make sure write is flushed adc->CR |= ADC_CR_ADEN; - while(!(adc->ISR & ADC_ISR_ADRDY)) + while (!(adc->ISR & ADC_ISR_ADRDY)) ; // Set ADC clock cycles sample time for every channel