2024-08-07 12:58 AM - edited 2024-08-07 01:00 AM
Hi,
I have setup the ADC in STM32H753ZIT6 to sample 4 channels with DMA in circular mode. This works as expected and I can check the values being updated in the "Live Expressions" tab.
But there is an offset, which I can only get rid of, if I perform the calibration of the ADC each time I start the ADC.
The reason I start the ADC and calibrate again, is that seems to be the only way to get correct results. The DMA is setup to circular mode, so normally the ADC would only be started once. But as explained, this leads to an offset on all ADC values of some 0.05V.
Any help is appreciated. Thank you.
uint16_t ADC_result[4];
while (1)
{
HAL_ADCEx_Calibration_Start(&hadc2, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED);
HAL_ADC_Start_DMA(&hadc2, &ADC_result, 4);
}
Solved! Go to Solution.
2024-08-07 05:28 AM
HAL_ADCEx_Calibration_Start should be called only once at the program start. What values do you get if you do that? Be specific. You can't recalibrate it if the ADC is already busy.
Is this a custom board? Is VDDA/VREF+ handled appropriately?
2024-08-07 05:28 AM
HAL_ADCEx_Calibration_Start should be called only once at the program start. What values do you get if you do that? Be specific. You can't recalibrate it if the ADC is already busy.
Is this a custom board? Is VDDA/VREF+ handled appropriately?
2024-08-07 05:30 AM
Thank you for your answer.
I am not sure what has happened in the meantime, but it works now. I calibrate once and start the ADC with DMA and everything is running and precise.