Jetson TX2 SPI

Hi, dear!
I have a Jetson TX2, Ubuntu 18.04, and L4T R32.3.1. And I need to use SPI interface. As I know, SPI is disable in default.
I am trying to enable SPI interface, using prompts from website https://elinux.org/Jetson/TX2_SPI . But this article is for another version of L4T, and I make some changes, using prompts: change “…/kernel-4.4/…” to “…/kernel-4.9/…”, change “tegra18_defconfig” to “tegra_defconfig”, change “…spi/spidev.ko…” to “…spi/spidev.c…”.

After “Building Kernel” step and rebooting system, my Ubuntu crashes with errors (and not boot):
[FAILED] Failed to start Load Kerlen Modules
and
[FAILED] Failed to start nvpmodel service

Please, tell me, how to enable and use SPI on Jetson TX2 and R32.3.1? Where can I find usermanual and description, what to do after I will reinstall Ubuntu?

You may not export LOCALVERSION=-tegra to build the kernel image cause the module failed load.

Sorry, I didn`t understant, how your note can help me.

Ok, I found the document ( https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/hw_setup_jetson_io.html ), which states that “Starting with L4T release 32.3, NVIDIA provides the Jetson-IO tool to simplify the configuration of the I/Os exposed by the 40‑pin expansion header” and I don`t have to build the kernel! So, I have 32.3.1.

  1. I tried firest step:
$ sudo /opt/nvidia/jetson-io/jetson-io.py

and had an issue, that described in the document: “A known issue in L4T release 32.3.1 causes the following error to occur when launching Jetson-IO”.
2) Second step - is resolving issue:

$ sudo find /opt/nvidia/jetson-io/ -mindepth 1 -maxdepth 1 -type d -exec touch {}/__init__.py \;
  1. Third step is like a first step
$ sudo /opt/nvidia/jetson-io/jetson-io.py

And I see the IO tool screen without header (something wrong whith IO tool view), and I see only a 23-40 pins (!Why?).
4) I choose “Configure 40‑pin expansion header”.
5) I see only 5 lines, and the 4-th line is “spi4” (19,21,23,24). I choose by “*” spi4.
6) I choose “Save and reboot to reconfigure pins”, Jetson reboots.

After the Jetson reboots, I see an Nvidia icon, then white (full white) screen, then after few seconds black screen and then nothing… even not a single letter.

Tell me please, what is going on?

Can’t see the problem as you report.
Could you attached the screenshot for first step that you said only see 23-40 pins
And could you try if reflash the whole image to check if the problem can be fixed?

Yes, I tried reflashing whole image, but it didn`t help, the same result.

Screenshot of the first step: https://yadi.sk/d/wc84dZKJXsUOnw
Screenshot of the 5-th step: https://yadi.sk/d/hgzIgSksSo59yw
Screenshot of the white screen (bonus): https://yadi.sk/d/rZPo1O9xotNIfA

Did you use customize carrier board?

No, we use Jetson TX2 development kit

Could you try use devmem2 to configure the SPI pin instead of jetson_io to try.

https://devtalk.nvidia.com/default/topic/1049170/jetson-agx-xavier/spi1-not-work-on-xavier/post/5325856/#5325856

Yes, of course, I can try to do that. Tell me, please, where can i find some usermanual for configure the SPI pin, using devmem2? I had never worked with devmem2 and I have no idea, how to do that.

Find the address from the file …/Linux_for_Tegra/bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p2888-0000-p2822-0000.cfg and use devmem2 to write it to correct value after boot to linux.

Yesterday I tried to find the path …/Linux_for_Tegra/bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p2888-0000-p2822-0000.cfg but i couldn’t. Could you please provide an absolute path to this file.

For TX2 it should be the tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg
any cfg file at …/Linux_for_Tegra/bootloader/t186ref/BCT/ ?

Please, see the photo: https://yadi.sk/d/Icf894WBgK0dNA
I cannot find this file and the directory “Linux_for_Tegra”.

Hi nikolaskv,

The “tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg” is on your host machine.
If you are using sdkmanager to download image, the file location: /home//nvidia/nvidia_sdk/JetPack_4.3_Linux_P3310/Linux_for_Tegra

Hi, carolyuu!
OMG!))) it is radically changes the case! Thank you. I`ll try.

Finally Ive found the file: <a target='_blank' rel='noopener noreferrer' href='https://yadi.sk/i/9p08lWgRapDQIA'>https://yadi.sk/i/9p08lWgRapDQIA</a> But the the content of the file is quite different from example that you provided (<a target='_blank' rel='noopener noreferrer' href='https://devtalk.nvidia.com/default/topic/1049170/jetson-agx-xavier/spi1-not-work-on-xavier/post/5325856/#5325856'>https://devtalk.nvidia.com/default/topic/1049170/jetson-agx-xavier/spi1-not-work-on-xavier/post/5325856/#5325856</a>). So, i hid the rows, which dont include the word “spi”, and now you can look file content: https://yadi.sk/i/jrt3QywSUyXW_Q

Now please tell me, what I have to change. Please, don`t forget that in Jetson-IO tool I saw only SPI4, and no SPI1 or SPI2 (see the photo above)

Did you connect to J21 pin 19,21,23,24?
Then you need to check below memory address.

pinmux.0x02430038 = 0x00000401; # gpio_cam4_pn3: spi4, tristate-disable, input-disable
pinmux.0x02430040 = 0x00000455; # gpio_cam5_pn4: spi4, pull-down, tristate-enable, input-enable
pinmux.0x02430048 = 0x00000401; # gpio_cam6_pn5: spi4, tristate-disable, input-disable
pinmux.0x02430050 = 0x00000409; # gpio_cam7_pn6: spi4, pull-up, tristate-disable, input-disable

Sorry, I don`t understand, what does it mean “connect to J21 pin 19,21,23,24”? Connect to what? Now we speak about the host machine.

Now I see the following text regarding the addresses, that you specified, in the file “tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg”:

#### Pinmux for gpio-input pins ####
pinmux.0x02430038 = 0x00000000; # GPIO gpio_cam4_pn3
pinmux.0x02430040 = 0x00000000; # GPIO gpio_cam5_pn4
pinmux.0x02430048 = 0x00000000; # GPIO gpio_cam6_pn5
pinmux.0x02430050 = 0x00000000; # GPIO gpio_cam7_pn6

#### Pinmux for used pins ####
pinmux.0x02430038 = 0x00000056; # gpio_cam4_pn3: rsvd2, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x02430040 = 0x00000056; # gpio_cam5_pn4: rsvd2, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x02430048 = 0x00000056; # gpio_cam6_pn5: rsvd2, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x02430050 = 0x00000058; # gpio_cam7_pn6: rsvd0, pull-up, tristate-enable, input-enable, lpdr-disable

The word “spi4” is not found in the text.

Your SPI device connect to which SPI pin?
The SPI4 is old version cfg file however the REG memory address is the same.

My device is not connected yet, because we didnt enable SPI on my Jetson. The question is - how to enable SPI. But when we will enable SPI, Ill connect my device to any pin, you will say. I think, it will be 19,21,23,24 (according to JETSON TX2 HEADER PINOUT).

Ok, so in what place I have to make changes: #### Pinmux for gpio-input pins #### or #### Pinmux for used pins #### or both? What result should be at the end?

#### Pinmux for gpio-input pins ####
pinmux.0x02430038 = 0x00000401; # GPIO gpio_cam4_pn3
pinmux.0x02430040 = 0x00000455; # GPIO gpio_cam5_pn4
pinmux.0x02430048 = 0x00000401; # GPIO gpio_cam6_pn5
pinmux.0x02430050 = 0x00000409; # GPIO gpio_cam7_pn6

OR

#### Pinmux for used pins ####
pinmux.0x02430038 = 0x00000401; # gpio_cam4_pn3: rsvd2, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x02430040 = 0x00000455; # gpio_cam5_pn4: rsvd2, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x02430048 = 0x00000401; # gpio_cam6_pn5: rsvd2, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x02430050 = 0x00000409; # gpio_cam7_pn6: rsvd0, pull-up, tristate-enable, input-enable, lpdr-disable