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.

AM62A7-Q1: Use the mw command in Uboot to control the GPIO output high

Part Number: AM62A7-Q1

Tool/software:

HI

There is an LED in TI's AM62A7-Q1 EVM board that is controlled by a GPIO1_49, and I want to light this LED with the mw command in Uboot.

I first checked pinmux and used the command as follows

=> md.l 0x000F4244 1
000f4244: 00040007                             ....

Next, I configured the GPIO0_DIR23 RegisterGPIO0_OUT_DATA23

mw.l 0x601038 0x02ffff 1
mw.l 0x60103c 0x20000 1

LED1 does not light up.

What's wrong with my approach?

If I need to manipulate GPIO1_6 instead of GPIO1_49, how do I confirm that I am writing bits to those registers?

Thanks,

Yuwei

  • Hello Yuwei,

    Toggling a GPIO-LED is slightly different than toggling a LED or GPIO. The LEDs are linked through a GPIO as indicated by 'compatible = "gpio-leds";' in the device tree.


    You can try either of these options:

    1. Enable the LED_GPIO support in U-Boot and use those set of commands as seen below:

    2. Or Make GPIO1_49 a normal GPIO and continue using a register write. Since the GPIO is wired to the LED, making the output High will turn on the LED. Here is a patch to do so:

    diff --git a/arch/arm/dts/k3-am62a7-sk.dts b/arch/arm/dts/k3-am62a7-sk.dts
    index 8b5c2543..57705002 100644
    --- a/arch/arm/dts/k3-am62a7-sk.dts
    +++ b/arch/arm/dts/k3-am62a7-sk.dts
    @@ -149,20 +149,6 @@
                    enable-active-high;
                    gpio = <&exp1 3 GPIO_ACTIVE_HIGH>;
            };
    -
    -       leds {
    -               compatible = "gpio-leds";
    -               pinctrl-names = "default";
    -               pinctrl-0 = <&usr_led_pins_default>;
    -
    -               led-0 {
    -                       label = "am62a-sk:green:heartbeat";
    -                       gpios = <&main_gpio1 49 GPIO_ACTIVE_HIGH>;
    -                       linux,default-trigger = "heartbeat";
    -                       function = LED_FUNCTION_HEARTBEAT;
    -                       default-state = "off";
    -               };
    -       };
     };
     
     &main_pmx0 {
    @@ -386,6 +372,8 @@
     
     &main_gpio1 {
            status = "okay";
    +       pinctrl-names = "default";
    +       pinctrl-0 =<&usr_led_pins_default>;
     };
     
     &main_gpio_intr {
    

    Best Regards,

    Anshu