cancel
Showing results for 
Search instead for 
Did you mean: 

Open drain pin is pulling down slightly on STM32G081RB

NathanWolcott
Associate III

I am using pin PA8 in open drain GPIO output mode to control the power supply voltage on a custom board. Normally, the power supply output 5V but when PA8 is set low, it adds an extra 3k resistor to ground to the voltage feedback pin on the power supply and the output switches 12V.

The voltage feedback node is nominally 2.5V.

This works fine except that when PA8 is high (open drain), the supply outputs around 7.5V and the voltage at the PA8 pin is around 1.5V, not the 2.5V I would expect. Internal pull-ups and pull-downs are disabled.

I rewired the prototype board and switched to a different pin (PB11) and everything worked correctly. This problem exists on all of the prototype boards that we have powered up so far.

What is going on? Why is that particular pin acting like it has a very weak pull-down when high instead of going open drain?

1 ACCEPTED SOLUTION

Accepted Solutions

PA8 is UCPD1_CC1which has a pulldown enabled after reset. Disable it by setting SYSCFG_CFGR1.UCPD1_STROBE .

JW

View solution in original post

7 REPLIES 7

Something else attached to it? Shorted to a neighbouring pin?

Xray board? Check continuity on unpopuled board?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

No, it doesn't seem to have anything to do with the board itself.

I just reproduced the problem on a stock G071RB Nucleo board.

  1. Create a blank project for that board in cubeMX. Set PA8 to open drain mode, high state, no pulls.
  2. Hooked a 3K resistor to the pin and connected the other end to a 2.5V bench supply.
  3. Loaded the code. Right after starting the debugger, while the system is still halted at the main() breakpoint, the voltage at the pin is 2.5V.
  4. Run the code. Once the GPIO init runs, the voltage drops to around 1.5V.

PA8 is UCPD1_CC1which has a pulldown enabled after reset. Disable it by setting SYSCFG_CFGR1.UCPD1_STROBE .

JW

That fixed it.

Thanks!

KPeso.1
Associate II

Hi all,

Where did you add the line: SET_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_UCPD1_STROBE)? I have added it before and after GPIO init, but it seems not to disable the pulldown on PA8 pin on my G070KB (32pin). I have PA9 configured as UART_TX. Is there something else needed to set/reset in the registers?

I put the line after the GPIO Init (and after all of the other HAL peripheral inits).

Also, I didn't set the bit directly but used the helper function:

HAL_SYSCFG_StrobeDBattpinsConfig(SYSCFG_UCPD1_STROBE);

This shouldn't make any difference, since it looks like the helper function just sets the bit.

Hope that helps.

KPeso.1
Associate II

Thank you. I actually seemed to got it working by putting the line right after the  HAL_Init(); (before SystemClock_Config();), but not sure if this place was the key, or what changed.