Skip to main content
Visitor II
February 2, 2025
Question

ADC changes values after voltage change on neighboring channel

  • February 2, 2025
  • 3 replies
  • 532 views

Hello All, 

We have a problem with crosstalk between two neighboring ADC pins. On a STM32L496, on PA7 and PC4, two independent single-ended ADC channels are configured in the most simplified way possible. 

Connected pins and ADC config: 

ChipConnectedPins.pngAdcConfig.png

Method/Function:

This is the function to read the ADC value.

uint32_t getVoltageADC(ADC_HandleTypeDef *hadc, uint8_t channel) {
 // Configure the ADC channel parameters
 ADC_ChannelConfTypeDef sConfig = {
 .Channel = STM32ADCChannelLookUp[channel],
 .SamplingTime = ADC_SAMPLETIME_640CYCLES_5,
 .Rank = 1
 };

 HAL_StatusTypeDef status = HAL_OK;	 // Initialize status variable to track HAL function success
 status |= HAL_ADC_ConfigChannel(hadc, &sConfig);	 	// Configure ADC channel
 status |= HAL_ADC_Start(hadc); 		// Start ADC conversion
 status |= HAL_ADC_PollForConversion(hadc, HAL_MAX_DELAY);	// Wait for conversion to complete
 uint32_t raw = HAL_ADC_GetValue(hadc);	// Retrieve raw ADC value
 status |= HAL_ADC_Stop(hadc);			// Stop ADC operation
 assert(status == HAL_OK);
 HAL_Delay(5);							// Ensure all HAL operations completed successfully
 return (uint32_t)raw; 					// Return the raw ADC value
}
 

It is called with

ai_throttleRead = getVoltageADC(&hadc1, 12);

The hardware design can be found in the attached image. Throttle (c_throttleRead) is an input from 1-5V, Regen (c_regenRead) is a 10k potentiometer, powered by 3.3V. 

Problem:

As long as the potentiometer for the regen is not connected, the throttle works perfectly and has an ADC value of 1500 for 1V (0.64V at pin) and larger values for more throttle. This seem high but I can handle that in the software.

If the regen potentiometer gets connected, the reading for the constant throttle voltage of 1V changes from ADC=2500 if GND is connected and ADC=600 for 3.3V on the regen pin. In other words, changing the voltage at the neighboring pin, changes the ADC reading. 

Notes: 

  1. Neighboring pins can be configured as a differential input. (Maybe part of the problem?) 
  2. It is only for those two pins the case. 

Tests:

  1. Use hadc1 for throttle and hadc2 for regen does not change the behavior at all. 
  2. Connect the regen to a spare analog input solved the problem (undesirable!). It is specific for these two pins. 
  3. A lot of different software configurations didn't change it. 
  4. Same behavior for multiple identical boards. 

Hardware 

PcbSchematics.png

Hardware Chip: STM32L496VGTx

 

 

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    March 18, 2025

    Hello,

    Did you test with a non-neighboring channels?

    Super User
    March 18, 2025

    Have you measured externally at the pins?

    Explorer
    March 18, 2025

    This is normal, considering 27k /47k divider. To have low transit error buffer ADC inputs using high speed OPA, that can operate at 3.3V and has R2R outputs.