Skip to main content
Graduate II
November 26, 2025
Solved

GPIO output not working

  • November 26, 2025
  • 1 reply
  • 192 views

Hi, 

I’m working on an STM32G491 MCU and facing an issue with GPIO PB9.

In my project, I initialize PB9 as a digital output and try to set it HIGH, but the pin always stays LOW on the board.

However, if I configure PB9 as input and toggle the pin externally in the same circuit, I can read HIGH and LOW correctly.

Why would PB9 not go HIGH when configured as output? What could be the possible reasons or things to check?

    This topic has been closed for replies.
    Best answer by abhijith_raj

    @Ozone 
    Issue identified: I’m using STM32CubeIDE with the default CubeMX plugin for pin configuration. The pin was originally set as an input, and when I changed it to output in CubeMX, the generated code didn’t update accordingly. CubeMX wasn’t regenerating the new pin configuration in my project, so the code still had the old input settings.

    1 reply

    Explorer
    November 26, 2025

    Nobody on this forum has a crystal ball, so you should post the relevant code.
    There is even a specific editor menu point for that ('</>').

    > Why would PB9 not go HIGH when configured as output?

    Have you checked the schematics of your board ?
    Other hardware at that pin might interfere.

    Is the peripheral clock for GPIOB enabled ?

    > ... and try to set it HIGH, but the pin always stays LOW on the board.

    The STM32 GPIOs have separate registers for input and output, and separate output registers to set or reset pins.
    Share the relevent code.

    abhijith_rajAuthorAnswer
    Graduate II
    November 26, 2025

    @Ozone 
    Issue identified: I’m using STM32CubeIDE with the default CubeMX plugin for pin configuration. The pin was originally set as an input, and when I changed it to output in CubeMX, the generated code didn’t update accordingly. CubeMX wasn’t regenerating the new pin configuration in my project, so the code still had the old input settings.