2026-01-23 8:26 PM
Hi I'm using STM32G0B0RET6, and im using ADC Channel 1,4,5,6,7,10,11,15, and 16 . and sequencer is set to not fully configurable because if set to fully configurable then i can't use Channel 15 and 16.
So here for all ADC channels i'm getting same values, can anyone help me resolve this issue
Initiated like this
HAL_ADCEx_Calibration_Start(&hadc1);
and
this my ADC reading part
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, 200);
chanel1 = HAL_ADC_GetValue(&hadc1); //MDB 4 Vout sense
HAL_ADC_PollForConversion(&hadc1, 200);
chanel4 = HAL_ADC_GetValue(&hadc1); //Vcharge sense
HAL_ADC_PollForConversion(&hadc1, 200);
chanel5 = HAL_ADC_GetValue(&hadc1); //MDB 3 Vout sense
HAL_ADC_PollForConversion(&hadc1, 200);
chanel6 = HAL_ADC_GetValue(&hadc1); //MDB 2 Vout sense
HAL_ADC_PollForConversion(&hadc1, 200);
chanel7 = HAL_ADC_GetValue(&hadc1); //MDB 1 Vout sense*/
HAL_ADC_PollForConversion(&hadc1, 200);
chanel10 = HAL_ADC_GetValue(&hadc1); //Vbattery sense
HAL_ADC_PollForConversion(&hadc1, 200);
chanel11 = HAL_ADC_GetValue(&hadc1); //Vbattery sense
HAL_ADC_PollForConversion(&hadc1, 200);
chanel15 = HAL_ADC_GetValue(&hadc1); //Vsupply sense
HAL_ADC_PollForConversion(&hadc1, 200);
chanel16 = HAL_ADC_GetValue(&hadc1); //VCHG sense
HAL_Delay(300);
HAL_ADC_Stop(&hadc1);
2026-01-24 12:06 AM
I am not familiar with HAL libraries, but if I am not mistaken, the HAL_ADC_GetValue() function only reads the conversion result. So you run one conversion and then read it 9 times in a row. Since you are not running another conversion, you keep reading the same result of the first conversion over and over again. You still need to trigger the conversions, most likely using HAL_ADC_Start(). Or you can use some form of "automated" conversion, for example using a sequencer and DMA.
Look up ADC_MultiChannelSingleConversion in
STM32Cube_FW_G0_V1.6.2\Projects\NUCLEO-G0B1RE\Examples\ADC
2026-01-24 7:15 AM
Use DMA to convert multiple channels. See here for an example:
Or convert a single channel and change the channel number before each conversion.
There is no buffer in the ADC to store all results. Each conversion overwrites the last so you need something like DMA to do this.