cancel
Showing results for 
Search instead for 
Did you mean: 

ADC calibration when using DualMode on a STM32H743

Post edited by ST moderator to be inline with the community rules for the code sharing. In next time please use </> button to paste your code and a linker script content. Please read this post: How to insert source code.

Hello,

I ran into a very strange problem with a STM32H743 that I don't understand.

I have the following config sequence:

  1. MX_ADC1_Init() -> generated by CubeMX
  2. MX_ADC2_Int() -> generated by CubeMX
  3. HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED)
  4. HAL_ADCEx_Calibration_Start(&hadc2, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED)

The MX_ADC1_Init() contains the following generated code:

 multimode.Mode = ADC_DUALMODE_REGSIMULT;
 multimode.DualModeData = ADC_DUALMODEDATAFORMAT_DISABLED;
 multimode.TwoSamplingDelay = ADC_TWOSAMPLINGDELAY_1CYCLE;
 if (HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode) != HAL_OK)
 {
   Error_Handler();
 }

This worked without a problem on all my boards so far and I was able to start a DMA conversion. However, I just got a new hardware batch (exactly the same PCB design as the previous ones) and here the HAL_ADCEx_Calibration_Start for the ADC2 (ADC1 works fine) always gets stuck for multiple seconds, until it timeouts and fails...

By playing around with the initialization sequence, I was able to find out that apparantely I have to call HAL_ADCEx_Calibration_Start for both ADCs before configuring the MultiMode.

Is wasn't able to find anything on this in the ApplicationNotes. Is there some explanation for my observation? What is the reason for the ADC2 calibration to get stuck, even though the ADC was not started before?

Is this a bug in the CubeMX generated code (that the MultiMode is configured too early)?

 

0 REPLIES 0