mirror of
https://github.com/micropython/micropython.git
synced 2025-07-21 04:51:12 +02:00
stm32/machine_adc: Enable ADC re-read errata handling for STM32WB55.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
This commit is contained in:
committed by
Damien George
parent
3e33d0567f
commit
17898f8607
@@ -445,10 +445,13 @@ static void adc_config_channel(ADC_TypeDef *adc, uint32_t channel, uint32_t samp
|
||||
|
||||
static uint32_t adc_read_channel(ADC_TypeDef *adc) {
|
||||
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
|
||||
{
|
||||
|
Reference in New Issue
Block a user