Skip to content

Commit 7e16045

Browse files
gautierg-staescolar
authored andcommitted
drivers: adc: stm32: fix stm32u5 extended calibration
Add Data Memory Barrier during the extended calibration of STM32U5, as it is done in STM32Cube HAL, to avoid sporadic errors during calibration that may result in measures that are offset from real values. Signed-off-by: Guillaume Gautier <[email protected]>
1 parent 00bb90a commit 7e16045

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/adc/adc_stm32.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,9 @@ static void adc_stm32_calibration_start(const struct device *dev)
549549
if ((dev_id != 0x482UL) && (rev_id != 0x2001UL)) {
550550
adc_stm32_enable(adc);
551551
MODIFY_REG(adc->CR, ADC_CR_CALINDEX, 0x9UL << ADC_CR_CALINDEX_Pos);
552+
__DMB();
552553
MODIFY_REG(adc->CALFACT2, 0xFFFFFF00UL, 0x03021100UL);
554+
__DMB();
553555
SET_BIT(adc->CALFACT, ADC_CALFACT_LATCH_COEF);
554556
adc_stm32_disable(adc);
555557
}

0 commit comments

Comments
 (0)