diff options
| author | Damien George <damien@micropython.org> | 2025-06-25 14:23:36 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-07-08 13:14:43 +1000 |
| commit | ea2000b81d2007e373a302d5361455147c693dbb (patch) | |
| tree | d0e6c73e4a299dd6f1b7fbb4cda2669532806325 | |
| parent | 9a9e5529af9012534f2935474476d631c1e7cb81 (diff) | |
stm32/adc: Apply re-read errata for WB55.
Following 17898f8607dc4fb881e860719cc1906d304e60f4.
Signed-off-by: Damien George <damien@micropython.org>
| -rw-r--r-- | ports/stm32/adc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ports/stm32/adc.c b/ports/stm32/adc.c index 3549fc29a..239175bac 100644 --- a/ports/stm32/adc.c +++ b/ports/stm32/adc.c @@ -464,10 +464,13 @@ static void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel) static uint32_t adc_read_channel(ADC_HandleTypeDef *adcHandle) { uint32_t value; - #if defined(STM32G4) - // For STM32G4 there is errata 2.7.7, "Wrong ADC result if conversion done late after - // calibration or previous conversion". According to the errata, this can be avoided - // by performing two consecutive ADC conversions and keeping the second result. + #if defined(STM32G4) || defined(STM32WB) + // For STM32G4 errata 2.7.7 / STM32WB errata 2.7.1: + // "Wrong ADC result if conversion done late after calibration or previous conversion" + // states an incorrect reading is returned if more than 1ms has elapsed since the last + // reading or calibration. According to the errata, this can be avoided by performing + // two consecutive ADC conversions and keeping the second result. + // Note: On STM32WB55 @ 64Mhz each ADC read takes ~ 3us. for (uint8_t i = 0; i < 2; i++) #endif { |
