Xavier NX pinmux configuration for SPI using Jetson-IO tool

Hi,

We are trying to get SPI running on our custom carrier board.

We are using the same pins of the Jetson Xavier NX SoM that are used for the 40-pin Extension Header on the NVIDIA Dev-Kit (jakku). Accordingly, we are also using the original device tree files of the JetPack 4.6.2 (L4T R32.7.2), downloaded via SDK Manager tool (version 1.8.4.10431). We used the following command to install the Jetson OS components:

sdkmanager --cli install --logintype devzone --product Jetson --target JETSON_XAVIER_NX_TARGETS --targetos Linux --version 4.6.2 --select 'Jetson OS'

and obtained the kernel and device tree sources via the following command:

./source_sync.sh -t tegra-l4t-r32.7.1

We used the default kernel config file ‘tegra_defconfig’ for compiling the kernel and device tree sources.

According to the Jetson Xavier NX Product Design Guide (page 69 and 70) I assumed that with this default configuration the following SPI interfaces would be available:

  • SPI1 on SoM pins 89, 91, 93, 95, 97 and
  • SPI3 on SoM pins 104, 106, 108, 110, 112.

Actually, there is no communication visible when measuring with oscilloscope; neither on SPI1 nor on SPI3 pins.

Our workflow for launching SPI communication is as follows:

  • sudo insmod /lib/modules/4.9.253-tegra/kernel/drivers/spi/spidev.ko makes the linux devices spidev0.0/.1 and spidev2.0/.1 available.
  • Open and configure SPI device using ioctl()-operations.
  • Transfer data via SPI using ioctl()-operations.

Instead of being able to use the SoM pins for SPI communication (SFIO) we are able to use them as GPIOs via the sysfs interface (export, set direction, set pin value). This should not be able if the pins are (correctly) configured as SFIO pins right?

In the original/unmodified Pinmux Spreadsheet downloaded from Jetson Download Center column Customer Usage is set to GPIO, not to SFIO. So, the pins of SPI1 and SPI3 are not configured for SPI communication.
This is consistent with the behavior we observe as we are able to control the GPIO, but are unable to use the pins as SFIO for SPI communication.

According to section 40-pin GPIO Expansion Header in the Developer Guide - and more specifically the sub-section Pinmux Configuration - the Jetson-IO tool may be used to change the pinmux configuration of the 40-pin GPIO Expansion Header. We performed the following steps to change pinmux configuration via th Jetson-IO tool:

After the reboot the pinmux configuration remains unchanged:

Why is the pinmux configuration created with Jetson-IO tool not applied?

Are we missing something to get the SPI1 on pins 89, 91, 93, 95, 97 and SPI3 on pins 104, 106, 108, 110, 112?

Thanks in advance!
Bruno

Could you check /boot/extlinux/extlinux.conf to make sure load the DTB modify by jetson-io.

TIMEOUT 30
DEFAULT JetsonIO

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      FDT /boot/dtb/kernel_tegra194-p3668-0000-p3509-0000.dtb
      INITRD /boot/initrd
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
#      sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

# LABEL backup
#    MENU LABEL backup kernel
#    LINUX /boot/Image.backup
#    FDT /boot/dtb/kernel_tegra194-p3668-0000-p3509-0000.dtb
#    INITRD /boot/initrd
#    APPEND ${cbootargs}













LABEL JetsonIO
        MENU LABEL Custom Header Config: <HDR40 User Custom [2022-10-19-160429]>
        LINUX /boot/Image
        FDT /boot/kernel_tegra194-p3668-0000-p3509-0000-user-custom.dtb
        INITRD /boot/initrd
        APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

1 Like

Hi Shane,

this is my /boot/extlinux/extlinux.conf file:

TIMEOUT 30
DEFAULT JetsonIO

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
#      sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

# LABEL backup
#    MENU LABEL backup kernel
#    LINUX /boot/Image.backup
#    INITRD /boot/initrd
#    APPEND ${cbootargs}


LABEL JetsonIO
	MENU LABEL Custom Header Config: <HDR40 User Custom [2022-10-18-104721]>
	LINUX /boot/Image
	FDT /boot/kernel_tegra194-p3668-all-p3509-0000-user-custom.dtb
	INITRD /boot/initrd
	APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

The LABEL JetsonIO is written but compared to your example the FDT in both, LABEL primary and LABEL JetsonIO are missing. But without these lines the .dtb file(s) are not loaded.

I suppose for LABEL primary the FDT line is not necessary because the default is automatically loaded.
But for the customized .dtb file of LABEL JetsonIO the FDT line is mandatory to apply the changes made in Jetson-IO tool.

Is this correct or are both the FDT lines mandatory?

Best regards
Bruno

Could you check the /boot/kernel_tegra194-p3668-0000-p3509-0000-user-custom.dtb file by dtc to to uncompiled to dts to confirm those spi pins configuration.

Hi Shane,

I will check that, but got some other task I need to do first.

Hi Shane,

here is my decompiled /boot/kernel_tegra194-p3668-all-p3509-0000-user-custom.dtb:

kernel_tegra194-p3668-all-p3509-0000-user-custom.dts (255.4 KB)

When I examined the pinmux@2430000 module I came to the conclusion that SPI function should be available on SoM pins 89, 91, 93, 95, 97 for SPI1 and 104, 106, 108, 110, 112 for SPI3 or did I miss something?

I decompiled the .dtb file using the following command:

dtc -I dtb -o kernel_tegra194-p3668-all-p3509-0000-user-custom.dts kernel_tegra194-p3668-all-p3509-0000-user-custom.dtb

I received a lot of Warnings during decompilation but I don’t think they are relevant:
Warnings_Decompiling.txt (23.0 KB)

I still have to test my modified extlinux.conf with FDT commands added! I will post the conclusion of this modification as soon as I complete the test.

Looks like the decompile file is correct.
Could you dump the device tree by below command to confirm the hdr40-pin*

sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree

The dumped device-tree:
extracted_proc.dts (253.5 KB)
(Again, with warnings, probably non-relevant: extracted_proc_Warnings.txt (18.5 KB))

Looks like the system didn’t apply the /boot/kernel_tegra194-p3668-all-p3509-0000-user-custom.dtb
Maybe can try replace the dtb file at Linux_for_Tegra/kernel/dtb/tegra194-p3668-all-p3509-0000.dtb by kernel_tegra194-p3668-all-p3509-0000-user-custom.dtb and flash the device again.

1 Like

Hi Shane,

thanks for the advice. First, I will try to fix it by modifying the extlinux.conf (adding the FDT command that was missing compared to the extlinux.conf you shared). If this doesn’t fix the problem, I will replace the Linux_for_Tegra/kernel/dtb/tegra194-p3668-all-p3509-0000.dtb and re-flash the Jetson Xavier NX.

Thanks for your support so far! I will post the result as soon as I complete the tests.

Recap:

  • Adding the FDT commands in extlinux.conf didn’t work!
  • Replacing the Linux_for_Tegra/kernel/dtb/tegra194-p3668-all-p3509-0000.dtb by kernel_tegra194-p3668-all-p3509-0000-user-custom.dtb generated by JetsonIO Tool and re-flashing the Jetson Xavier NX Module fixed the problem.

Thanks Shane!

1 Like

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