cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H725 ADC3 IN12 different transfer function??

ibanez_ramdsp
Associate

Hi, we are using the MCU STM32H725IGKx  (UFBGA176)  ADC3 configured as follows.

 

/** Common config
*/

hadc3.Instance = ADC3;
hadc3.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV1;
hadc3.Init.Resolution = ADC_RESOLUTION_12B;
hadc3.Init.DataAlign = ADC3_DATAALIGN_RIGHT;
hadc3.Init.ScanConvMode = ADC_SCAN_ENABLE;
hadc3.Init.EOCSelection = ADC_EOC_SEQ_CONV;
hadc3.Init.LowPowerAutoWait = DISABLE;
hadc3.Init.ContinuousConvMode = DISABLE;
hadc3.Init.NbrOfConversion = 6;
hadc3.Init.DiscontinuousConvMode = DISABLE;
hadc3.Init.ExternalTrigConv = ADC_EXTERNALTRIG_T8_TRGO;
hadc3.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;
hadc3.Init.DMAContinuousRequests = ENABLE;

hadc3.Init.SamplingMode = ADC_SAMPLING_MODE_NORMAL;
hadc3.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DMA_CIRCULAR;

hadc3.Init.Overrun = ADC_OVR_DATA_PRESERVED;
hadc3.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE;
hadc3.Init.OversamplingMode = DISABLE;

if (HAL_ADC_Init(&hadc3) != HAL_OK)
{
Error_Handler();
}


/** Configure Regular Channel
*/

sConfig.Channel = ADC_CHANNEL_0;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC3_SAMPLETIME_640CYCLES_5;
sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0;
sConfig.OffsetSign = ADC3_OFFSET_SIGN_NEGATIVE;
 

It converts four external channels + Vrefint + Vsense. Base ADC clock frequency is 1.5MHz.

The external channels are :

  • IN0 => PC2_C
  • IN1 => PC3_C
  • IN12 => PC2
  • IN14 => PH3
/**ADC3 GPIO Configuration

PC2 ------> ADC3_INP12
PC2_C ------> ADC3_INP0
PC3_C ------> ADC3_INP1
PH3 ------> ADC3_INP14
*/

GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

GPIO_InitStruct.Pin = AIN_AUX2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(AIN_AUX2_GPIO_Port, &GPIO_InitStruct);

HAL_SYSCFG_AnalogSwitchConfig(SYSCFG_SWITCH_PC2, SYSCFG_SWITCH_PC2_OPEN);
HAL_SYSCFG_AnalogSwitchConfig(SYSCFG_SWITCH_PC3, SYSCFG_SWITCH_PC3_OPEN);

 

The conversion process is executed using DMA transfer. Single DMA Transfer is over when all 6 channels are converted.

the DMA transfer is stable and so is the data we obtain.

The problem we face is that the channel IN12 (PC2) seems to have a different transfer function as the rest of channels.

We have applied the same voltage to IN12 (PC2) and IN1 (PC3_C) and we get different binary values.

Here 1024 samples are shown , COMPAMP_UTTEMP (IN12) and COMPAMP_LTTEMP (IN1).

ibanez_ramdsp_0-1719421864391.png

 

Since IN12 (PC2) is connected internal to all 3 ADC,

we did the same test with PC2 connected to ADC2_IN12 (ADC2 configured as 12 bits) with the same result.

we did the same test with PC2 connected to ADC1_IN12 (ADC1 configured as 12 bits) with the same result.

 

The Voltage measured with a multimeter at MCU pins PC2 and PC3_C is identical, nevertheless we get the ADC data shown in the previous graph.

 

The ADC3 calibration is done during boot process.

 

Can you give us a hint/explanation why IN12 behave different on all 3 ADC?

 

 

 

 

 

 

2 REPLIES 2
AScha.3
Chief II

Hi,

these xx_C pins are not "normal" pins, they are connected via an alalog switch :

AScha3_0-1719423235497.png

and from ds also:

AScha3_1-1719423292581.png

(I dont use this xxx pins, if possible.)

In your measured data you can see: the blue from PC2 is much more clean than the data from PC3_C ;

read in rm , how to connect the xx_C pins - if you really need to use them.

And care for higher resistance with this analog mux, needs more sampling time (slower sampling).

 

 

If you feel a post has answered your question, please click "Accept as Solution".

Hi,

in the trace we uploaded, PC3_C is giving the right binary value. The wrong channel is INP12 connected PC2. And it is wrong when configured for ADC1, ADC2 and ADC3.

We keep the switch you mention OPEN (Not connected) as shown in the code in our first post.

We did read the manual and tried different sampling frequencies with different source impendaces for  the ADC driver.

The result is always the same:

  • Identical voltage measured at MCU pins PC2 and PC3_C.
  • Wrong binary value at INP12 and right binary value at PC3_C.