Skip to content

AdcMcuReadChannel sampling time is too low, causing BoardBatteryMeasureVoltage to return incorrect values #1617

@nfroggy

Description

@nfroggy

This applies at least on the NucleoL476 sample code, probably worth looking at the other STM32 sample code as well.

This line sets the ADC sampling time to 92 cycles for every ADC read. The problem is that when it's this low, it makes BoardBatteryMeasureVoltage return incorrect values when the input voltage is under 2.6 volts. We were able to solve this by changing the ADC sampling time to 640 cycles (ADC_SAMPLETIME_640CYCLES_5). This does slightly increase the amount of time the ADC takes to read, but given that AdcMcuReadChannel recalibrates the ADC every time it does a read, I'm assuming ADC read performance isn't a priority anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions