2025-11-20 9:03 PM
I turned off all the other configuration aka Alternate Functions..only enabled GPIO PA5 as output Pushpull mode, low freq.its doesnt turn on or off individually..tried to turn on and off using HAL as well as direct registers..both work only when PA4 turns on ...what i mean if i want to turn on PA5 i should turn on PA4, then only it works..what is this causing this issue.can you help me out.tried on multiple hardwares..same issue so hardware issue eliminated, no pin short circuit.
Solved! Go to Solution.
2025-11-20 10:53 PM
And in addition to that, check the schematics and user manual of your unnamed board, if external wiring could interfere.
2025-11-20 10:17 PM
Double check that the generated code uses GPIO_PIN_5 and port GPIOA. Debug step into the HAL code setting PA5 like HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);.
While debugging, check the peripheral registers view (aka STM32Cube Registers Tree) for GPIOA registers ODR and IDR.
Its extremely unlikely that you found a chip related mismatch because G0 series was introduced in 2019 and there is nothing about that in the errata sheet.
hth
KnarfB
2025-11-20 10:53 PM
And in addition to that, check the schematics and user manual of your unnamed board, if external wiring could interfere.
2025-11-21 12:40 AM
@Ozone @KnarfB Thanks for the ANswers..@OZone Schematics and board is a simple dev board which extends the pins of ic to more usable berg strip and programming done via direct 3v3 to SWD interface which works for past 8years.No hardware issue found. @KnarfB i looked into debugginf SFR register of GPIOA..
both PA4 and PA5 Configured as ouput. both turned on and off after 2 sec => step by step debug reveals while starting..
after HAL_init->MODER register 0xebffffff,IDR=>0x00,ODR=>0x00
after GPIOA clock enable-> IDR=>0x400,
after GPIO init-> IDR=>0x400, MODER=>0xebfff5ff
and come into while after PA4 writen on ->IDR=>0x4010,ODR=>0x10(till now ODR is 0x00)
and after PA5 is written on->nothing changes
while doing this repeated debug steps..both PA4and PA5 configured as GPIO(removed PA4 in another test still same result)..and turing PA5 only ON and OFF...step by step reveals...
after HAL_Init->MODER register 0xebffffff,IDR=>0x00,ODR=>0x00
after GPIOA clock enable-> IDR=>0x400,
after GPIO init-> IDR=>0x400, MODER=>0xebfff5ff
and come into while after PA5 writen on ->IDR=>0x4020,ODR=>0x20(till now ODR is 0x00)
and come into while after PA5 writen off ->IDR=>0x4000,ODR=>0x00..
Please help me out on this issue..i attach my code also
2025-11-21 12:59 AM
> and come into while after PA5 writen on ->IDR=>0x4020,ODR=>0x20(till now ODR is 0x00)
> and come into while after PA5 writen off ->IDR=>0x4000,ODR=>0x00..
Which means it works as expected, or not ?
ODR = 0x20 means bit 5 (which is PA5) is set.
2025-11-21 1:06 AM
Output is Not HIGH even though it set ODR=0x20, but idr 0x4010 and odr 0x10 means PA4 and PA5 both on..i know its strange but i am facing this issue. i am thinking configuration is wrong now after bit of searching PA5 configured as still analog..moder register should be after GPIO init-> IDR=>0x400, MODER=>0xebfff1ff instead, MODER=>0xebfff5ff..is that so..if thats the case GPIO init is not working..its standard Cube code of HAL gpio init..or am i thinking wrong
2025-11-21 1:18 AM
> Output is Not HIGH even though it set ODR=0x20, but idr 0x4010 and odr 0x10 means PA4 and PA5 both on..
First, IDR reflects the input state - which is just the (internal) read-back value.
The ODR register reflects the (internal) output register value.
IDR=0x4010 + ODR=0x10 does not mean both PA4 and PA5 is on.
IDR=0x4010 means PA14 and PA4 H (on), and ODR=0x10 mean PA4 is H.
Consequently, ODR=0x20 would mean PA5 is set.
> Output is Not HIGH ...
Check directly on the processor pin.
The only way to configure a GPIO pin as output with the logic level remaining not visible is setting it as open-drain output. The OD configuration requires an external pull-up resistor to work.
Check the respective MODER register value for PA5, and compare it against the reference manual for your MCU.
2025-11-21 2:07 AM
Thank you for the reply its issue resolved works as intended PCB internal short resolved