Skip to main content
Visitor II
June 20, 2019
Solved

Open drain pin is pulling down slightly on STM32G081RB

  • June 20, 2019
  • 4 replies
  • 4218 views

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?

    This topic has been closed for replies.
    Best answer by waclawek.jan

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

    JW

    4 replies

    Graduate II
    June 20, 2019

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

    Xray board? Check continuity on unpopuled board?

    Visitor II
    June 21, 2019

    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.
    Super User
    June 22, 2019

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

    JW

    Visitor II
    June 24, 2019

    That fixed it.

    Thanks!

    Visitor II
    December 26, 2019

    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?

    Visitor II
    December 30, 2019

    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.

    Visitor II
    December 31, 2019

    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.