Hello,
Could someone give me some direction on how I can set a GPIO pin HIGH during boot, before the kernel is loaded. We designed a custom carrier board for the Jetson Nano Production Module, the main power supply enable on the carrier board is connected to pin GPIO3_PDD.00, the enable pin needs to be high for the power supply to be active.
The SoM is running L4T 32.7.2
I read the Bring Up and Adaptation Doc to try to accomplish this but no luck.
Thus far I have exported the customized pinmux excel sheet where I set GPIO3_PDD.00 to an output and set initial state to “Drive 1”.
I then replaced the following two files with the files I exported from the sheet:
Linux_for_Tegra/source/public/hardware/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0002-b00.dtsi
Linux_for_Tegra/source/public/hardware/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi
using the following command I compiled the dts files:
cd source/public/kernel/kernel-4.9/
sudo make ARCH=arm64 dtbs
sudo make CROSS_COMPILE=$HOME/l4t-gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- ARCH=arm64 dtbs
Then I copied the following file to L4T dir:
cp source/public/kernel/kernel-4.9/arch/arm64/boot/dts/tegra210-p3448-0002-p3449-0000-b00.dtb ./kernel/dtb/tegra210-p3448-0002-p3449-0000-b00.dtb
Then I used the following command to flash the new dtb:
sudo ./flash.sh -k DTB jetson-nano-emmc mmcblk0p1
Before flashing I decompiled the the new device tree and I confirmed that the pin I want GPIO3_PDD.00 is set to high:
I can see that pin 0xe8 is now in “gpio-output-high”
default { gpio-input = <0x0c 0x0d 0x0e 0x0f 0x22 0x05 0xbc 0xbd 0xbe 0xc1 0xc2 0xa8 0xa9 0x4d 0x14 0x3a 0x3d 0x3f 0x41>; gpio-output-low = <0xcb 0x38 0x3b 0x3c 0x40 0x42>; gpio-output-high = <0xe8 0x06 0xbb 0xe7>; linux,phandle = <0x41>; phandle = <0x41>; };
Which is great because now after the system boots the systems stays on, but the pin only goes high after the kernel is loaded. This takes around 8 seconds, which is way too long. Is there a way to drive GPIO3_PDD.00 pin high before the kernel is loaded? I tried to recompile u-boot, but the resulting device tree does not have a gpio defaults section is it.
Since cboot source is not available u-boot seems like the place were I should try set the pin high.
I added the following code to “/Linux_for_Tegra/source/public/u-boot/board/nvidia/p3450-0000/p3450-0000.c”
#include <asm/gpio.h>
void pin_mux_mmc(void)
{
struct udevice *dev;
uchar val;
int ret;
printf(“Setting Power EN pin HIGH \n”);
gpio_request(TEGRA_GPIO(DD, 0), “Power EN”);
gpio_direction_output(TEGRA_GPIO(DD, 0), 1);
to compile and flash u-boot I ran the following commands.
from “/Linux_for_Tegra/source/public/u-boot"
sudo make distclean
sudo make p3450-0000_defconfig
sudo make CROSS_COMPILE=$HOME/l4t-gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
sudo cp u-boot{,.bin,.dtb,-dtb.bin} Linux_for_Tegra/bootloader/t210ref/p3450-0000
Then from “/Linux_for_Tegra/"
sudo ./flash.sh jetson-nano-emmc mmcblk0p1
The result of this is the following output from the debug console:
U-Boot 2020.04 (Aug 26 2022 - 00:10:50 -0400)
SoC: tegra210
Model: NVIDIA Jetson Nano Developer Kit
Board: NVIDIA P3450-0000
DRAM: 4 GiB
Setting Power EN pin HIGH
MMC: sdhci@700b0000: 1, sdhci@700b0600: 0
Loading Environment from MMC… OK
In: serial
Out: serial
Err: serial
Net: No ethernet found.
Hit any key to stop autoboot: 0
MMC: no card present
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1…
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
879 bytes read in 24 ms (35.2 KiB/s)
1: primary kernel
Retrieving file: /boot/initrd
7160179 bytes read in 176 ms (38.8 MiB/s)
Retrieving file: /boot/Image
Still the pin only goes high after the device tree is loaded.
Which is too late…