Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
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); } }