SPI Slave Communication in AGX Orin

Hi,
I need to perform SPI Slave communication on my Jetson AGX Orin.
I had also raised a previous topic but couldn’t reply back so opening a new topic.

I have also attached the dmesg and the kernel files with this message.
dmesg.txt (75.0 KB)
kernel_tgra234_log.txt (458.8 KB)

Previous Topic:SPI Slave for AGX Orin

Regards
Srivathsan P

	spi@3210000 {
		compatible = "nvidia,tegra186-spi-slave";

It seems you want to use SPI1 from 40-pins expansion header (PIN19, PIN21, PIN23, PIN24, PIN26).

Have you run “sudo modprobe spidev” to load the driver?
Please also share your current status and what’s your SPI master.

yes i want to use SPI1
yes i ran sudo modprobe spidev
SPI master is Aurix Tricore 397 board

Hi. I have the same problem. When I disconnect the CS pin from the master (STM32H743ZI) and probe it using oscilloscope, Jetson Agx Orin generates CS signals (High to Low and high ) which means Jetson Agx Orin is master.

How did you verify the SPI slave on AGX Orin?

Do you send data from your SPI master(Aurix Tricore 397) and get the expected data at SPI slave(AGX Orin)?

Update of my test result.
I ran the test again and find out that the SPI CS pin of the Jetson Agx Orin became output mode after I changed
spi@3210000{ compatible = “nvidia, tegra186-spi-slave”;

  • symptom
  1. When I disconnect the spi cs pin from my STM32H743 evaluation board and measure the CS signal of the STM32H743, its value is stay high in idle mode and became low in TX mode.
  2. When I connect CS signal to Jetson AGX Orin, the CS signal goes to ground even in idle mode. When I run spi test program on Jetson, it complains that the SPI_Transfer function is failed. It worked when
  3. spi@3210000{ compatible = “nvidia, tegra186-spi”;

dmesg.txt (89.7 KB)
kernel_tegra234-p3701-0004-p3737-0000-user-custom.txt (529.9 KB)

Have you configured the pinmux for CS pin to be input?

yes
that’s the way
but we are not getting the desired output

Below information is what I have done.

  • I haven’t changed pinmux spreadsheet at all.
  • I opened /opt/nvidia/jetson-io/jetson-io.py and enabled SPI on 40-pin header. I believe this update changes pinmux values.
    If I have done up to here, I can check that the SPI on 40-pin header works as Master because CS signal comes from 40pin header.
  • After that, I have updated kernel_tegra234-p3701-0004-p3737-0000.dts (from dtb) from
    spi@3210000{ compatible = “nvidia, tegra186-spi”; to
    spi@3210000{ compatible = “nvidia, tegra186-spi-slave”;
    Then, CS pin signal goes LOW and running C or python program to transmit or receive data is no longer working.

My question is

  1. I believe spi@3210000{ compatible = “nvidia, tegra186-spi-slave”; is updating pinmux value and its modification is executed by your in-house code.
    So, what is additionally running when “-slave” is attached in spi@3210000 configuration?
    I believe “-slave” should change pinmux value of CS from output to input. Please let me know if my understanding is not correct or any information you need from me.
    Thanks in advance

As my understanding, you have to configure pinmux correctly before enabling it in device tree.
Driver would control the pin but won’t configure the pinmux.

Could you share the steps how you verify SPI slave?
Do you see any error in dmesg during transaction?

  1. in which file do we need to configure the pinmux? is there a seperate file
  2. i tried to verify the spi slave communication using logic analyzer
  3. is there any kernel code that we need to write other than a spidev program?
  4. when we connect our master we get some random values
  5. when we disconnect the master all we get is FF and 00

Please refer to the instruction in Jetson AGX Orin Platform Adaptation and Bring-Up — NVIDIA Jetson Linux Developer Guide 1 documentation to update pinmux.

I’m still not clear about how you verify SPI slave.
How do you want to use AGX Orin as SPI slave?
doing something after receiving specific data? What data you send from SPI master currently?

from the master i’ll be sending commands to control a video stream
to start stop change view and all
from the spi slave rx buffer i’ll send it to my program which will control the streams

so my slave should always be open to recieve the commands
my doubts are
the change for spi-slave under spi@321 and later after setting the pins using jetson-io and doing modprobe spidev
i was not getting the received data on the terminal for the device and instead i got some garbage values

so is there any more configuration changes that i need to do
the program i used was w.r.t linux/spidev.c program

also
the change i’m doing is after flashing
i need to do it before flashing
so in public sources which file do i need to change and build the kernel and flash?

currently i’m sending values like 0A0A, 0E0E

Could you configure the pinmux through pinmux spreadsheet instead of jetson-io since you are using it as SPI slave rather than SPI master?

Please refer to Jetson AGX Orin Platform Adaptation and Bring-Up — NVIDIA Jetson Linux Developer Guide 1 documentation to configure the pinmux before flash.

i’ll try it and let u know