Skip to main content
Visitor II
January 30, 2024
Solved

PA9 is high voltage level when configured as input pull-down mode

  • January 30, 2024
  • 2 replies
  • 1904 views

Hello, everyone.

    I use STM32L496 on my board, and use PA9 as a GPIO for input, without any external resister.

    Software program is based on HAL. I have a sample demo like this:

    int main(void)
    {
        HAL_Init();
        BSP_Init();

        while(1)
        {
            delay_ms(1000);
        }
    }

    While, in the BSP_Init(), like this:

    void BSP_Init(void)
    {
        GPIO_InitTypeDef GPIO_InitStruct = {0};

        __HAL_RCC_GPIOA_CLK_ENABLE();

        GPIO_InitStruct.Pin       = GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11
        GPIO_InitStruct.Mode   = GPIO_MODE_INPUT;
        GPIO_InitStruct.Pull      = GPIO_NOPULL;     // or GPIO_PULLDOWN
        GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
        HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

    }

 

    But, on the board, I measured PA9 has a high voltage level, but PA10 and PA11 is low. If do not call BSP_Init(), PA9 is high level,too. If a change GPIO_InitStruct.Pull to GPIO_PULLDOWN, the result is same as above. I checked the register, three pin has the same configure. And no other place configure these pin.

    Is there same mistake about my use? It's been bothering me for a long time. Does anyone provide any help, Thanks very much!

1.png2.png

    This topic has been closed for replies.
    Best answer by Michal Dudka

    A) Show us all relevant schematic (U1 TX2)
    B) Check PCB trace from shortcut to VCC
    C) Explain how exactly did you measured "high level" on pin without pullup/down. It is little bit tricky to measure floating input !

    2 replies

    Technical Moderator
    January 30, 2024

    Hello, 

    In your schematics there is the signal called "U1 TX2". What kind of signal is this: input or output? The voltage you are measuring could be sourced by this signal.

    Could you please share the schematics?

    Visitor II
    January 31, 2024

    Thank you for reply.  "U1 TX2" is input, and it connect nothing. I will check carefully.

    Graduate II
    January 30, 2024

    A) Show us all relevant schematic (U1 TX2)
    B) Check PCB trace from shortcut to VCC
    C) Explain how exactly did you measured "high level" on pin without pullup/down. It is little bit tricky to measure floating input !

    Visitor II
    January 31, 2024

    Thank you for reply.  I will check carefully according to your recommendation.