cancel
Showing results for 
Search instead for 
Did you mean: 

ADC

MichaelR
Associate II

I am using NUCLEO-G071RB. I use 2 ADC channels: GPIO analog and internal temperature sensor. I connect the +3.3V to the GPIO analog pin via. potentiometer. The internal temperature looks like it works well (the temperature rises slightly when I put a finger on the MCU), but the GPIO analog give constant value, no mater what is the analog voltage attached to it (the voltage is monitored using oscilloscope)

The configuration:

MichaelR_0-1719492704186.png

My code:

while (1)

{

/* USER CODE END WHILE */

 

/* USER CODE BEGIN 3 */

 

HAL_ADC_Start_DMA(&hadc1, adcCount, 2);

HAL_Delay(1000);

}

 

}

 

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)

{

if (hadc->Instance == ADC1)

{

// Process the ADC values

voltage = VDD * adcCount[0] / 4095.0f;

temp = ((VDD * adcCount[1] / 4095.0f - V30) / Avg_Slope) + 30.0f;

 

}

}

 

0 REPLIES 0