2026-03-09 4:57 AM - last edited on 2026-03-09 8:28 AM by FBL
Hello,
I am currently working with the STM32G030C8TX microcontroller and I have encountered an issue while reading analog values through the ADC.
When I attempt to read ADC values from the PB11 and PB12 pins, the measured values are incorrect or unstable. However, when I use other ADC-capable pins on the same microcontroller, the readings appear to be correct and stable.
Because of this behavior, I am unsure whether:
I would appreciate it if you could clarify whether these pins are valid ADC inputs on the STM32G030C8TX and if there are any known limitations or special configurations required.
Solved! Go to Solution.
2026-04-02 2:01 AM
Oh, so you probably attempt to use the fully configurable sequencer mode (I don't know how is it called in Cube/CubeMX, I don't use Cube). That has this limitation, as documented in the RM (and CubeMX attempted to prevent you from going against it):
JW
2026-03-09 5:06 AM
Hello,
Are you sure there is no other hardware connections to these pins apart of ADC connections?
2026-03-09 5:12 AM - edited 2026-03-09 5:15 AM
Hi,
shows no problem with PB11 and PB12 pins ,
the pins should give correct ADC values :
You choose in15 and 16 ?
2026-03-09 5:16 AM
Hello @EGurd.1
Please check if the clock for GPIO PORT B is enabled.
2026-03-09 5:26 AM
> I am currently working with the STM32G030C8TX microcontroller and I have encountered an issue while reading analog values through the ADC.
And what hardware you are talking about, a commercial board (like Nucleo), or a custom design ?
> When I attempt to read ADC values from the PB11 and PB12 pins, the measured values are incorrect or unstable.
What makes you think that, i.e. what do the results look like ?
Have you tried Vin=0V and Vin=Vref on this inputs ?
2026-04-01 5:18 AM
As you see on CUBEMX, it can not determine channel number only if PB11 or PB12 is choosen.
Even though CUBEMX cant determine channel number, I rewrite sconfig.channel as for channel 15 (PB11) and channel 16 (PB12).
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_16;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLINGTIME_COMMON_1;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) {
Error_Handler();
}HAL_ADC_Start(&hadc1);
while (1) {
if (HAL_ADC_PollForConversion(&hadc1, 100) == HAL_OK) {
adcValues[0] = HAL_ADC_GetValue(&hadc1);
}
}
2026-04-02 1:51 AM - edited 2026-04-02 2:02 AM
Measure voltage (using multimeter or oscilloscope) directly at the given pins.
Read out GPIOB_MODER register content and check if PB10/PB11 are set as Analog.
[EDIT] see my post below
JW
2026-04-02 2:01 AM
Oh, so you probably attempt to use the fully configurable sequencer mode (I don't know how is it called in Cube/CubeMX, I don't use Cube). That has this limitation, as documented in the RM (and CubeMX attempted to prevent you from going against it):
JW
2026-04-02 2:32 AM
Hi,
the old CHSELRMOD problem....see :
https://community.st.com/t5/stm32-mcus-products/stm32g030-adc-issue/m-p/316178
vs
So set CHSELRMOD = 0 , to select ch 0...18 .