This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM6548: Unable to enable pull-up/down resistor for the GPIO

Part Number: AM6548


Tool/software: Linux

Hello,

I have encountered some problems when I enable pull-up/down resistor for the GPIO. The followings are my steps to reproduce the problem.

For example, I need to enable pull-up for the PIN P4 (WKUP_GPIO0_29)

1. Configure device tree or write 0x00060007  WKUP_PADCONFIG17  (input enable, output enable, pull-up selected, pull enabled)

2. Configure GPIO device as input using the following command

echo 215 > /sys/class/gpio/export

echo in> /sys/class/gpio/gpio215/direction

3. Read input value

cat /sys/class/gpio/gpio215/value

4. Result

the value read from GPIO is 0 when the input pin is floating

What I'm expecting is 1 because of the internal pull-up resistor.

Am I missing anything? Thank you.

  • Thanks for posting your question.
    Our response may be delayed due the holidays.
  • Hi user559396,

    I would suggest you to update DT as below:

    linux-kernel/arch/arm64/boot/dts/ti/k3-am654-base-board.dts

    &wkup_pmx0 {
    push_button_pins_default: push_button__pins_default {
    pinctrl-single,pins = <
    AM65X_WKUP_IOPAD(0x0030, PIN_INPUT | MUX_MODE7) /* (R5) WKUP_GPIO0_24 */
    AM65X_WKUP_IOPAD(0x003c, PIN_INPUT | MUX_MODE7) /* (P2) WKUP_GPIO0_27 */
    +AM65X_WKUP_IOPAD(0x0044, PIN_INPUT_PULLUP | MUX_MODE7) /* (P4) WKUP_GPIO0_29 */
    >;
    };

    Then you can check in user space the value of register WKUP_PADCONFIG17/0x4301C044 and verify it has the correct value.

    Regards,
    Pavel
  • If you have no more questions related to the subject of this e2e thread, pelase close/verify/resolve this thread.

    Regards,
    Pavel
  • Hello,

    Thank you for the reply. I have done some further tests, based on your suggestion.

    When input and pull-up configured, the register value is 0x60007, there seems no problem.

    And then, I tested more GPIOs, followings are the result.

    GPIO1_88: working

    WKUP_GPIO0_5: working

    WKUP_GPIO0_48: not working

    WKUP_GPIO0_49: not working

    WKUP_GPIO0_50: not working

    All the tests were done with latest SDK version 5.2.

  • Hi user559396,

    user5119396 said:

    WKUP_GPIO0_48: not working

    WKUP_GPIO0_49: not working

    WKUP_GPIO0_50: not working

    You need to add entries for these gpios also:

    linux-kernel/arch/arm64/boot/dts/ti/k3-am654-base-board.dts

    &wkup_pmx0 {
    push_button_pins_default: push_button__pins_default {
    pinctrl-single,pins = <
    AM65X_WKUP_IOPAD(0x0030, PIN_INPUT | MUX_MODE7) /* (R5) WKUP_GPIO0_24 */
    AM65X_WKUP_IOPAD(0x003c, PIN_INPUT | MUX_MODE7) /* (P2) WKUP_GPIO0_27 */
    +AM65X_WKUP_IOPAD(0x0044, PIN_INPUT_PULLUP | MUX_MODE7) /* (P4) WKUP_GPIO0_29 */
    +AM65X_WKUP_IOPAD(0x0090, PIN_INPUT_PULLUP | MUX_MODE7) /* (Y1) WKUP_GPIO0_48 */
    +AM65X_WKUP_IOPAD(0x0094, PIN_INPUT_PULLUP | MUX_MODE7) /* (Y3) WKUP_GPIO0_49 */
    +AM65X_WKUP_IOPAD(0x0098, PIN_INPUT_PULLUP | MUX_MODE7) /* (Y2) WKUP_GPIO0_50 */
    >;
    };

    Regards,
    Pavel

  • Yes, all the tests was done in both ways. Either DTS or direct register write. Seems not working at all.
    Tests GPIOS:
    WKUP_GPIO0_29: not working
    WKUP_GPIO0_48: not working
    WKUP_GPIO0_49: not working
    WKUP_GPIO0_50: not working
    Any further suggestions ? Thank you.
  • user559396,

    So you stated that it is working (you have value of 1) for these two GPIO pins:

    1. B22 gpio1_88
    2. AD3 wkup_gpio0_5

    Which linux numbers you are using for these two pins? Is it 179 for gpio1_88 and 186 for wkup_gpio0_5? I see you are using 215 for wkup_gpio0_29, can you try with 210 instead?

    Please provide me also the below registers values you have in user space:

    PADCONFIG192
    WKUP_PADCONFIG49
    WKUP_PADCONFIG17

    Please provide me also the value of the below GPIO1 and WKUP_GPIO0 registers. Check the values in user space, at the time you verify pin is working or not.

    GPIO_DIRx
    GPIO_IN_DATAx

    Regards,
    Pavel
  • Dear TI

    I have used WkUP_GPIO0_29   WKUP_GPIO0_48   WKUP_GPIO0_49 WKUP_GPIO0_50  on the EVM board

    state/gpio

    WKUP_GPIO0_29\

    WKUP_PADCONFIG17

    Linux Kernel Number:215

    WKUP_GPIO0_48

    \ WKUP_PADCONFIG36

    Linux Kernel Number:234

    WKUP_GPIO0_49

    \

    WKUP_PADCONFIG37

    Linux Kernel Number:235

    WKUP_GPIO0_50

    \

    WKUP_PADCONFIG38

    Linux Kernel Number:236

    Default register value

    0x00050004

    (cat Value is:0)

    0x08250007

    (cat Value is:1)

    0x08250007

    (cat Value is:1)

    0x08250007

    (cat Value is:0)

    PIN_INPUT_PULLUP

    0x00060007

    (cat Value is:1)

    0x00060007

    (cat Value is:1)

    0x00060007

    (cat Value is:1)

    0x00060007

    (cat Value is:0)

    PIN_INPUT_PULLDOWN

    0x00040007

    (cat Value is:1)

    0x00040007

    (cat Value is:1)

    0x00040007

    (cat Value is:1)

    0x00040007

    (cat Value is:0)

    so you can see this table:

    on the evm board,no matter what I config the dts is, wkup_gpio0_48  wkup_gpio0_49 is always 1  wkup_gpio0_50 is always 0

    could you  help me check what's the problem?

    thanks a lot

  • Asura,

    Let we focus on WKUP_GPIO0_29 for now.

    In PIN_INPUT_PULLDOWN state you have WKUP_GPIO0_29 = 0x00040007, which means you should have 0, but you have 1.

    You are using kernel number 215. How you calculate this number? Can you also try with number 210, is there any difference?

    Can you also provide below bit values you have in user space:

    WKUP_GPIO0.GPIO_DIR01[29] = ? (addr 0x42110010)
    WKUP_GPIO0.GPIO_IN_DATA01[29] = ? (addr 0x42110020)

    Regards,
    Pavel

  • Asura,

    If you have no more questions related to the subject of the e2e thread, please close/verify/resolve this thread.

    Regards,
    Pavel
  • Dear

    Thanks for you help.

    With further investigate, the problem was occurred on the board of our design.

    Soc's pull and pull down function is correctly.

    Asura