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.

SK-AM62B: Pin Control cannot set PIN with PULL_UP

Part Number: SK-AM62B

Hi everyone,

I am having trouble figuring out how to set a PIN with the PULL_UP argument via the pin controller.

I assumed that passing the PULL_UP argument to the AM62X_IOPAD() function in the device tree would do the job, but it doesn't seem to be working.

Here are the test steps:

The test LED on SK-AM62B is associated with GPIO1_49. By default, it blinks and works well under the LED subsystem.

I made modifications to the device tree file of am62xx-evm SDK 9.0. (arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi). The changes are as follows

git diff

index 07763091a..51e916a69 100644
--- a/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi
@@ -109,14 +109,6 @@ leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
                pinctrl-0 = <&usr_led_pins_default>;
-
-               led-0 {
-                       label = "am62-sk:green:heartbeat";
-                       gpios = <&main_gpio1 49 GPIO_ACTIVE_HIGH>;
-                       linux,default-trigger = "heartbeat";
-                       function = LED_FUNCTION_HEARTBEAT;
-                       default-state = "off";
-               };
        };

        tlv320_mclk: clk-0 {
@@ -225,7 +217,7 @@ AM62X_IOPAD(0x240, PIN_INPUT, 0) /* (D17/C15) MMC1_SDCD */

        usr_led_pins_default: usr-led-pins-default {
                pinctrl-single,pins = <
-                       AM62X_IOPAD(0x244, PIN_OUTPUT, 7) /* (C17/B15) MMC1_SDWP.GPIO1_49 */
+                       AM62X_IOPAD(0x244, PIN_INPUT_PULLUP, 7) /* (C17/B15) MMC1_SDWP.GPIO1_49 */
                >;
        };

sean:ti-linux-kernel$

However, after replacing the k3-am625-sk.dtb on the EVB, I cannot light up the LED.

Can anyone guide me on how to pull up a PIN via the pin controller (PINMUX)?

Thanks,

Sean

  • Hi Sean,

    after replacing the k3-am625-sk.dtb on the EVB, I cannot light up the LED.


    Can you clarify what the outcome should be?


    For LEDs, you would want to use PIN_OUTPUT so the output buffer will be enabled. PIN_INPUT will disable the output buffer and no voltage will flow out of the pin. PULL_UP/PULL_DOWN refers to the internal resistor status.

    If you are trying to set the LED to ON when the board boots, try changing the default-trigger property. Here is the documentation for common LEDs: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/Documentation/devicetree/bindings/leds/common.txt

    The userspace can control the LEDs under /sys/class/leds/ path.

    Best Regards,
    Anshu

  • Hi Anshu,

    Ultimately, my goal is to preset All PIN voltages using PINMUX. Not just LED.

    The LED is controllable under the /sys/class/leds path, but it is controlled by a high-layer LED driver. I just wonder how to control all pins by the lower layer pinctrl-single (PINMUX) driver.

    Before this, I utilized PIN C17 (gpio1_49) for a proof of concept. The voltages can be configured via the pinctrl-single driver if the user describes them in the device tree.

    Despite configuring pin C17 as PIN_OUTPUT, as per your suggestion, the associated LED does not light up.

    git diff
    
            usr_led_pins_default: usr-led-pins-default {
                    pinctrl-single,pins = <
    -                       AM62X_IOPAD(0x244, PIN_OUTPUT, 7) /* (C17/B15) MMC1_SDWP.GPIO1_49 */
    +                       AM62X_IOPAD(0x244, PIN_OUTPUT_PULLUP, 7) /* (C17/B15) MMC1_SDWP.GPIO1_49 */
                    >;
            };
    

    Thanks,

    Sean

  • Hi Sean,

    Just to clarify, you are trying to control the GPIO pins voltage states and you are testing this using the on-board LEDs. Is my understanding correct?

    I think a better way of testing he pins would be to measure the voltage using a multimeter or another tool (or even an external resistor + LED depending on the pin).

    Please also be aware that GPIO pins need a reference. You can follow this thread for an example: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1268671/sk-am62-using-the-gpios-in-the-40-pin-user-expansion-port/4804378


    Best Regards,
    Anshu

  • Hi Anshu,

    Yes, I want to control the GPIO pins and set an internal pull-up on it.

    Using the gpioset tool to control the LED is working fine, but I still cannot set the internal pull-up on the PIN.

    root@am62xx:~# gpioset gpiochip2 49=1 # turn on

    root@am62xx:~# gpioset gpiochip2 49=0 # turn off

    root@am62xx:~# gpioset gpiochip2 49=1 # turn on

    The device tree that I am using is:

    --- a/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi
    +++ b/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi
    @@ -105,19 +105,6 @@ framebuffer: framebuffer@ff700000 {
                    };
            };
    
    -       leds {
    -               compatible = "gpio-leds";
    -               pinctrl-names = "default";
    -               pinctrl-0 = <&usr_led_pins_default>;
    -
    -               led-0 {
    -                       label = "am62-sk:green:heartbeat";
    -                       gpios = <&main_gpio1 49 GPIO_ACTIVE_HIGH>;
    -                       linux,default-trigger = "heartbeat";
    -                       function = LED_FUNCTION_HEARTBEAT;
    -                       default-state = "off";
    -               };
    -       };
    
            tlv320_mclk: clk-0 {
                    #clock-cells = <0>;
    @@ -225,7 +212,7 @@ AM62X_IOPAD(0x240, PIN_INPUT, 0) /* (D17/C15) MMC1_SDCD */
    
            usr_led_pins_default: usr-led-pins-default {
                    pinctrl-single,pins = <
    -                       AM62X_IOPAD(0x244, PIN_OUTPUT, 7) /* (C17/B15) MMC1_SDWP.GPIO1_49 */
    +                       AM62X_IOPAD(0x244, PIN_OUTPUT_PULLUP, 7) /* (C17/B15) MMC1_SDWP.GPIO1_49 */
                    >;
            };
    
    @@ -568,3 +555,9 @@ dpi1_out: endpoint {
                    };
            };
     };
    +
    +&main_gpio1 {
    +       pinctrl-names = "default";
    +       pinctrl-0 = <&usr_led_pins_default>;
    +       status = "okay";
    +};

    I believe the PIN is capable of internal pull-up, as the documentation states:

    Is there anything else wrong?

    Note: Using a multimeter to measure the voltage of the pin is the same as looking at the light from the LED.

    Thanks,

    Sean

  • Hi Sean,

    I do not see any issues with the device tree you provided.

    I looked further into this issue. You are correct that GPIO1_49 can have the pull-up or pull-down modifier, but looking into the schematic of the board, GPIO1_49 is connected to that LED which may explain why the pull resistor does not have an effect. You can find more information on pages 8 & 38 of the SK-AM62B schematics here: https://www.ti.com/tool/SK-AM62B#design-files.

    Best Regards,
    Anshu