How to change TX2-NX GPIO status in dts and u-boot


Carrier board: our carrier board
We got some issues about gpio setting.
I want to change the default status of some gpio pins below into default output high from u-boot

GPIO3_PC.03 (gpio339)
GPIO3_PJ.02 (gpio394)

  1. I downloaded the TX2-NX u-boot source code ,changed some setting in pxe_utils.c
    pxe_utils.c (31.3 KB)

  2. After I flashed my u-boot, I used putty catch the boot log to verified my changed.
    It changed the gpio status correctly into output-high and I use command

cd /sys/class/gpio/
echo 394 > ./export
cat ./gpio394/direction
cat ./gpio394/value

The direction is out-put high, but the status I measured by using multimeter is Not high.
So I do some command as bellow

echo in > ./gpio394/direction
echo out > ./gpio394/direction
echo 0 > ./gpio394/value
echo 1 > ./gpio394/value

This time the LED light I connected on this gpio had light up, and the status I measured by using multimeter is correctly high.

My question are
1.How to change the TX2-NX gpio status in u-boot and how this problem appeared like I written above?
2.How to change the TX2-NX gpio status in dts-file?
Both of two problems does not appear on Nano and Xavier-NX module.

If you have any idea about my question, please contact me thanks.

hello iga00257,

there’re pinmux spreadsheets that define the default pin configurations, and it’s board configuration file to assign the pin settings during bootloader stage.
you should download the xls file to modify the pin settings, and please change the configuration applied by the software.
please see-also developer guide for reference, Pinmux Changes.

Hi JerryChang,

I know this way to change the default configuration, but my question is how to change its status during u-boot loading like my source code I attached.
I use the same way by using linux-gpio-library to change the gpio status during the boot stage on Nano’s u-boot and
Xavier-NX’s c-boot. I want to know why can’t I do the same thing on TX2-NX, because our product development needs to do this way to detect another pin’s status to change the target gpio pin’s status immediately on boot stage.

If you have any idea about my question, please contact me thanks.

hello iga00257,

as you can see in the pinmux spreadsheets, this depends-on the default settings.
for example, this pin, GPIO3_PC.03 (i.e. gpio339), it’s by default configured as Input/Int PU.
you may refer to TRM, if E_INPUT is set, this pin cannot be set to output.
update the pinmux configuration is necessary for your use-case, you may change pin direction from “input” to “output” or “bidirectional”;
after that, you should be able to toggle the pin in u-boot code.


Although it’s preferred to do your pinmux setup via the DTSI files generated by the pinmux spreadsheet as Jerry indicated, in your pxe_utils.c code, you can also update the pinmux regs directly (see the T186 TRM chapter on Multi-Purpose I/O Pins and Pin Multiplexing (Pinmuxing), section 14.14.2 is GPIO Output Configuration, IIRC). Find the correct register for the GPIO you wish to make an output (PADCTL_AO_XX_YYY_GPIOn, etc), and set E_INPUT to 0 via a register read/modify/write. Then configure your GPIO as an output as you’re doing in your code now.



This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.