cancel
Showing results for 
Search instead for 
Did you mean: 

ADC2 calibration

LKoe
Associate

Hi,

I have a problem with the ADC2 calibration on STM32H743VIT6(V). I use ADC1 and ADC2 in dual mode(Regular simultaneous mode). On some boards the ADC2 calibartion doesn't work. (The ADCAL-Bit in ADC_CR is not cleard after start).

On the boards where I have the problem with the ADC2 calibration, when I change the dual mode to simultaneous mode + Regular simultaneous mode the calibration of ADC2 works.

I don't unstertand this bevaior. 

What is the problem of ADC2 calibration on some controllers in Regular simultaneous mode.

 

6 REPLIES 6
Pierre_Paris
ST Employee

Hello @LKoe ,

Thank you for your question.

Q: "What is the problem of ADC2 calibration on some controllers in Regular simultaneous mode."

A: ADC1 (master) and ADC2 (slave) must not be used by the application and must wait calibration is complete. You must try first with HAL API.

 /* Run the ADC calibration in single-ended mode */
  if (HAL_ADCEx_Calibration_Start(&AdcHandle_master, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED) != HAL_OK)
  {
    /* Calibration Error */
    Error_Handler();
  }

  if (HAL_ADCEx_Calibration_Start(&AdcHandle_slave, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED) != HAL_OK)
  {
    /* Calibration Error */
    Error_Handler();
  }

 Then you can follow the Software procedure to calibrate the ADC at the page 925 of the Reference manual.

Best Regards,

Pierre

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Davood_Kesha
Associate III

Hello ST expert,

I have the same problem in STM32H750. If the ADC1 and ADC2 were independent mode, the calibration ADC would be done. However, there is problem with ADC2 calibration (slave) when it is in dual mode with ADC1. The configuration is the same for all conditions!
Could somebody help us in this issue?

Hi Pierre_Paris,

Unfortunately this procedure does not prevent from ADC2 to hang!

The main issue is that this is not systematic: on some MCUs it works all the time, on others it crashes from time to time, always on ADC2, and for some devices it crashes systematically. In the last case, we ended up by replacing the MCU, but THIS DEFINITVELY IS NOT A SOLUTION!!! 

So we finally decided to remove the calibration procedure of the ADCs to avoid losing money! But this is still not acceptable. We tried to get guidance from ST since 2020 (!?!?) and we are still in the same fog. Since we are now on production and we face some accuracy issues we would like to be able to run the calibration

In our project, we uses all three ADCs of an STM32H743VIT; ADC1 and ADC2 in simultaneous regular mode; the calibration is performed in the order ADC1, ADC2 and ADC3, and it very often hangs on ADC2.

We tried to secure the procedure by forcing a stop of each ADC prior to the calibration, and added some delay between the two ADC:

 

HAL_ADC_Stop(&hadc1); 

delay_ms(100);

if (HAL_ADCEx_Calibration_Start(&hadc1,ADC_CALIB_OFFSET_LINEARITY,ADC_SINGLE_ENDED)!=HAL_OK) PRINT(console_ctx,"Error ADC1 Calibration\n");

HAL_ADC_Stop(&hadc2); 

delay_ms(100);

if (HAL_ADCEx_Calibration_Start(&hadc2,ADC_CALIB_OFFSET_LINEARITY,ADC_SINGLE_ENDED)!=HAL_OK) PRINT(console_ctx,"Error ADC2 Calibration\n");

HAL_ADC_Stop(&hadc3); 

delay_ms(100);

if (HAL_ADCEx_Calibration_Start(&hadc3,ADC_CALIB_OFFSET_LINEARITY,ADC_SINGLE_ENDED)!=HAL_OK) PRINT(console_ctx,"Error ADC3 Calibration\n");

 

But still the same.

 

So it would be time that ST considers seriously this issue and give a clear guidance on how to calibrate ADC in dual simultaneous mode!

 

Thank you!

JyLo

 

Hello JLojo,

 

Thank you so much for your feedback.
Fortunately, I found the problem. In dual mode of ADC1 and ADC2, the slave ADC (adc2) should be calibrated in configuration before the master ADC (adc1) configuration. You can test it and please give me your feedback!

Best,
Davood.  

LKoe
Associate

Hi JyLo,

we "solved" the problem, that we use as ADC Mode the " Mode Dual combined regular simultaneous + injected simultaneous Mode" but we don't start injected ADC converions in the firmware.

With this mode, the ADC calibration works. We are in mass production with the product and no problems have occurred so far.

   

LKoe_0-1762252139561.png

BR Lutz

JLojo
Senior

Many thanks to you both Davood an Lutz for this tips.

I'm currently testing the first proposed option (calibrating ADC2 prior to ADC1) which appears a little more 'natural'...

I'll keep you posted on the results.

Best regards

JyLo