Skip to main content
Visitor
October 27, 2026
Solved

Need help for this problem : STM32G070 – PB15 GPIO input always reads LOW with internal pull-up enabled

Hi everyone,

I'm facing an issue while reading a tactile push button connected to PB15 on an STM32G070 series MCU.

The GPIO is configured as an input with an internal pull-up resistor. My expected behavior is:

Button not pressed: GPIO reads HIGH (1). Button pressed: GPIO reads LOW (0).

However, I'm always getting LOW (0), regardless of whether the button is pressed or released.

Here is what I've checked so far:

  1. Verified continuity between the button and the MCU pin; it seems fine.

  2. Checked the button pin configuration, it looks fine

  3. Tried reading the GPIO raw value in code, but it consistently returns 0.

I'm not sure whether I'm missing any thing

Could anyone suggest what I should check next to debug this issue?

I've attached images of the relevant configuration for reference.

Thanks in advance for your help!

 

waclawek.jan
waclawek.janBest answer
Super User
October 27, 2026

​

  

PB15 in ’G07x is the USB-C power delivery Dead-battery pin, with the consequence of having a pulldown controlled by another pin and a control bit - this is the case also of ‘G070 even if it’s a Value line and does not officially have the USBC-PD features.

This *is* actually documented in the DS, although not necessarily obvious from just clicking in CubeMX.

JW

​

5 replies

waclawek.jan
waclawek.janBest answer
Super User
October 27, 2026

​

  

PB15 in ’G07x is the USB-C power delivery Dead-battery pin, with the consequence of having a pulldown controlled by another pin and a control bit - this is the case also of ‘G070 even if it’s a Value line and does not officially have the USBC-PD features.

This *is* actually documented in the DS, although not necessarily obvious from just clicking in CubeMX.

JW

​

MOBEJ
ST Employee
October 27, 2026

Hello ​@naraen_harish , 

As ​@waclawek.jan mentioned, PB15 has a separate dead-battery pull-down that could explain this. Try disabling it during startup:

__HAL_RCC_SYSCFG_CLK_ENABLE();
HAL_SYSCFG_StrobeDBattpinsConfig(SYSCFG_UCPD1_STROBE |SYSCFG_UCPD2_STROBE);

Keep PB15 configured as input with pull-up. Does it now read HIGH when the button is released?


Br

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.
Andrew Neil
Super User
October 27, 2026

Here is what I've checked so far:

  1. Verified continuity between the button and the MCU pin; it seems fine.

  2. Checked the button pin configuration, it looks fine

  3. Tried reading the GPIO raw value in code, but it consistently returns 0.

But have you measured the actual voltage at the PB15 pin?

If that voltage is constantly low then, of course, the GPIO will always read 0 - so you’d need to look for what is pulling it down (probably ​@waclawek.jan has answered that)

 

See also:

 

For posting source code, please see:

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Visitor
October 27, 2026

Thank you ​@waclawek.jan  for your insight. It was really helpful. Now it’s working fine

Visitor
October 27, 2026

Thanks ​@MOBEJ ​@Andrew Neil . Now the issue resolved based on information provided by ​@waclawek.jan