Jetson agx orin use spi

image


How should I use this SPI?

This is a session I submitted earlier, but did not resolve.
So I submitted a new session to start troubleshooting again…


Follow this step?

Hi Andyyyyy,

It seems you are using the custom carrier board with JP5.1.2 as we discussed before.

Have you updated the pinmux correctly and verified the SPI loopback test?

This is for SPE to control SPI interface.
Your use case should be using SPI from kernel driver.

Please refer to the following step to verify SPI interface.

  1. configure pinmux and reflash to apply the change
  2. enable SPI node in device tree
  3. short MOSI/MISO and verify with SPI loopback test


I have updated the device tree and pinmux, and have re-flash, but I did not have success in loopback testing…

spi device tree file path:“/sources/Linux_for_Tegra/source/public/hardware/nvidia/soc/t23x/kernel-dts/tegra234-soc/tegra234-soc-spi.dtsi”

It seems you want to use SPI from SPE.
Please refer to the following instruction to enable it.
Jetson Sensor Processing Engine (SPE) Developer Guide: SPI application (app/spi-app.c) (nvidia.com)

Do you short D62/F60 before performing SPI loopback test?

Hi,

My SPI is not connected to a sensor processing engine, just a simple VCO chip…
I only want to use traditional spi and need it to configure my VCO chip register.I tried SPE SPI, short-circuiting D62/F60 did not successfully test spi loopback

So please help me, tell me how to configure the spi device tree, should I use spidev-X.X?

SPE seems in the module. Do you mean that it connect to a VCO chip externally?

I would suggest you using SPI0 or SPI1 for your use case.

Hello kevin,

yeah,You’re right. I have an external VCO chip.!


I can’t use spi0 and spi1 now, and I didn’t design the corresponding pins when I customized the board design.Therefore, I hope I can use SPI2. If SPI2 cannot be used normally, then I will set E61, D62, F60 and D60 as GPIO respectively and use GPIO to simulate SPI timing.

Do you mean that SPI0 and SPI1 are both not available on your custom carrier board?

To use SPI2, you have to enable it with the guide I shared above.
SPI2 is from SPE and it is not controlled by kernel.

Hello Kevin,

Yes, spi0 and spi1 were not used in the board design.
Then I will start by following your steps to enable SPE spi, please wait patiently for my loop test results…
We’re only using spi2

tegra234-mb1-bct-pinmux-p3701-0000-a04.txt (64.0 KB)
tegra234-mb2-bct-scr-p3701-0000-override.txt (1.5 KB)
tegra234-mb1-bct-gpio-p3701-0000-a04.txt (4.7 KB)
makeEspLog.txt (2.9 KB)
This is the file that I changed according to the steps.

  1. After compiling, I replaced the new spe_t234.bin
  2. Run flash:./flash.sh rg0-agx-orin-351 mmvblk0p1
  3. I did not see the corresponding spi after entering the system…

$ sudo modprobe spidev
$ wget https://raw.githubusercontent.com/torvalds/linux/v4.9/tools/spi/spidev_test.c
$ gcc -o spidev_test spidev_test.c
$ sudo ./spidev_test -D /dev/spidev2.0 -v -p “HelloWorld123456789abcdef”

If you perform the following steps, the spi loopback test fails.

You have to check serial console log for “spi_test” related messages in MB2.

SPI2 cannot be accessed in user space because it is from SPE so that I would suggest you using SPI0 or SPI1 instead.
You can check SPE SPI driver in spe-freertos-bsp/fsp/source/drivers/spi-mst/spi.c for details.

Hi Kevin,

Now I can’t use SPI0 and SPI1, because the version of the custom board has been confirmed, so I can’t change the hardware circuit design. If it can’t be used in user space, then I will change the four pins of SPI2 to GPIO, and I use GPIO to simulate SPI.

no problem, if emulating GPIO as SPI could meet your requirement.