7 years, 5 months ago.

ADC Calibration on STM32F103

I am using an STM32F103 to read the temperature signal from an LM35. I've read all the posts about likely errors involved with ADC inputs in noisy environments. My problem is that I need to use the STM self-calibration feature because I am getting an offset of about 50mV.

I can do it using the CMSIS function ADC_StartCalibration(), and it works incredibly well, down to a difference of only around 10 mV compared to my DVM. The problem is that 'mbed' moved away from CMSIS and replaced it all with the new HAL drivers from STM - this happened about version 95 of the mbed libraries. The only way I can access the CMSIS function is to deliberately use an early version of the mbed libraries. This will surely go wrong one day as I add more to the project.

My question is a general one - how exactly do I get access to the new HAL libraries which implement things like StartCalibration(). I know the name of the function [HAL_ADCEx_Calibration_Start(&ADC_1)] but I don't know how to call it.

The performance of the ADC is very poor without this self-calibration.

Help!

Thanks

-ptranter

1 Answer

7 years, 5 months ago.

Hello Philip,
This demo shows how to call the HAL_ADCEx_Calibration_Start() function whithin an mbed project. Use the graphical STM32CubeMX initialization code generator to create the configuration functions. Then copy-and-paste them into your project.
Zoltan