cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G030C8TX ADC Issue on PB11 and PB12 Pins

EGurd.1
Associate II

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:

  • PB11 and PB12 pins support ADC functionality on this device/package
  • There is a configuration issue on my side
  • Or there might be a silicon/production-related issue with the chip

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.

1 ACCEPTED SOLUTION

Accepted Solutions
waclawek.jan
Super User

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):

Clipboard_04-02-2026_01.png

JW

 

View solution in original post

8 REPLIES 8
mƎALLEm
ST Employee

Hello,

Are you sure there is no other hardware connections to these pins apart of ADC connections?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
AScha.3
Super User

Hi,

errata  https://www.st.com/resource/en/errata_sheet/es0486-stm32g030x6x8-device-errata-stmicroelectronics.pdf

shows no problem with  PB11 and PB12 pins , 

the pins should give correct ADC values :

Bildschirmfoto_2026-03-09_13-10-24.png

You choose in15 and 16 ?

If you feel a post has answered your question, please click "Accept as Solution".
Saket_Om
ST Employee

Hello @EGurd.1 

Please check if the clock for GPIO PORT B is enabled.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om
Ozone
Principal III

> 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 ?

 

EGurd.1
Associate II
adc.png

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();
    }
 I tried ADC poll for conversion for channel 10,11,15 and 16 seperately with this code. And the result was: channel 10 and 11 works perfectly. Even though channel 15 (PB11) is always 460 (12 bit adc max 4095) and channel 16 (PB12) is always 55. I already see voltage changes with ossiloscope on these pins, i can't see on debug.
HAL_ADC_Start(&hadc1);
    while (1) {
        if (HAL_ADC_PollForConversion(&hadc1, 100) == HAL_OK) {
            adcValues[0] = HAL_ADC_GetValue(&hadc1);
        }
    }

 

waclawek.jan
Super User

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

 

waclawek.jan
Super User

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):

Clipboard_04-02-2026_01.png

JW

 

AScha.3
Super User