mbed do not start adc calibration for STM32F3

01 May 2017

The AnalogIn reading for STM32F303K8 and STM334R8 is too low. However after adding call on HAL_ADCEx_Calibration_Start the reading is correct.

mbed do not start adc calibration for STM32F3 mcu's ?

Here is the code with the fix:

<<program https://developer.mbed.org/users/foggyfish/code/AnalogIn_fix_F3/

#include "mbed.h"

AnalogIn   ain(A5);
Serial pc(USBTX, USBRX); 

int main(void)
{
    //Starts ADC Calibration
    //Correct's bug in mbed for F303K8 and F334R8. 
    //mbed do not start adc calibration for STM32F3 mcu's ?
    extern ADC_HandleTypeDef AdcHandle;
    HAL_ADCEx_Calibration_Start(&AdcHandle, ADC_SINGLE_ENDED); 
    
    int nr = 0;           
    while (1) {
        nr++;
        pc.printf("nr  : %d\n", nr);
        pc.printf("normalized: %d \n", ain.read_u16());
        pc.printf("volt: %3.3f\n\n", ain.read()*3.3 );
        wait(1);
    }
}
01 Feb 2018

Hi

For information, ADC calibration has been added in https://github.com/ARMmbed/mbed-os/pull/5210

(MBED-5.7.0)

05 Feb 2018

Hi

For information, ADC calibration has been added in https://github.com/ARMmbed/mbed-os/pull/5210

(MBED-5.7.0)