STM32 ADC input pin decreases amplitude of waveform from function generator

I am using an STM32f429i-discovery to sample a sine-wave from an oscilloscope with a built-in function generator. But something strange happens when I connect genout to the ADC pin on the STM32. The waveform decreases in amplitude, as if the ADC is loading the function generator. The pictures below try to visualize the problem. First, we have the generated waveform without genout (the red clip) connected to the ADC pin. The sine-wave is just as I would expect from my settings, that is 1 Vpp.

enter image description here

Then we have the generated waveform with genout connected. The amplitude is seems to decrease. Now the amplitude is 400 mVpp

enter image description here

I’m wondering why this happens, and how it can be avoided. It destroys my ADC measurements.

I am using STM32CubeIDE for programming the device, and I attach the ADC_init function that it generates here:

static void MX_ADC1_Init(void)
{
  ADC_ChannelConfTypeDef sConfig = {0};
  /** Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)
  */
  hadc1.Instance = ADC1;
  hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2;
  hadc1.Init.Resolution = ADC_RESOLUTION_12B;
  hadc1.Init.ScanConvMode = DISABLE;
  hadc1.Init.ContinuousConvMode = DISABLE;
  hadc1.Init.DiscontinuousConvMode = DISABLE;
  hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;
  hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T8_TRGO;
  hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
  hadc1.Init.NbrOfConversion = 1;
  hadc1.Init.DMAContinuousRequests = ENABLE;
  hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
  if (HAL_ADC_Init(&hadc1) != HAL_OK)
  {
    Error_Handler();
  }

  /** Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
  */
  sConfig.Channel = ADC_CHANNEL_1;
  sConfig.Rank = 1;
  sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
  if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }
}

I am using PA1 as the ADC pin, and it appears to me that that is its only current function: –

enter image description here

Read more here: Source link