Who can help me program the script 'spidev_test'

I debugged the 40PIN SPI0 and SPI1, and the information is as follows:

Ø Board type: ORIN NANO 4GB NVIDIA;

Ø JetPack 5.1.5.

During debugging, I have been unable to obtain a suitable spidev_test. I started downloading a spidev_test on Githubusecontent. com, but it shows that the version is not supported. Later, Teacher Kevin FFF helped me write a spidev_test, which ran normally but could neither send nor receive data.

I have recorded the debugging steps here. Could you please help me check if my judgment is accurate? Steps are as follows:

Step 1: Connect the wires as shown in the following diagram:

Step 2: Check the addresses of SPI0 and SPI1, and then modify the device tree file (dtb - o tegra234-p3768-0000+p3767)-

0005-nv.dtb), Change SPI1 to “Slave” mode.

Step 3: Modify the file “/var/lib/python3/dist packages/Jetson/GPIO/gpio_pin_data. py” and remove the GPIO definitions for SPI0 and SPI1. The modification result is as follows:

Step 5: Debugging Preparation:

$Restart the development board;

$ sudo modprobe spidev

$ sudo /opt/nvidia/jetson-io/jetson-io.py

$ sudo chmod a+x spidev_test

Step 6: debugging process

6.1 Open a Shell window and enter the following command to receive:

$ Sudo Chmod 777 …/Downloads/pattern_record.txt

$ sudo …/Downloads/spidev_test -D /dev/spidev2.0 -s8000000 -g8 -b8 -H -f

…/Downloads/pattern_record.txt -n1 -zzz -r

6.2 Open another shell window and repeat the following send command:

$ Sudo Chmod 777 …/Downloads/pattern.txt

$ sudo …/Downloads/spidev_test -D /dev/spidev0.0 -s8000000 -g8 -b8 -H

-f …/Downloads/pattern.txt -n1 -zzz -t

Step 7: Test results:

  7.1:No content was received when viewing pattern_decord. txt;

  7.2:Use Python. py to continuously input the send command of 6.2, and use an oscilloscope to detect SPI0_MOSI. It was found that there was no waveform output.

Additionally:

I tested the receiving function of “spidev_test” on the board I designed (using the MCU to send SPI data), but still couldn’t receive any data. So I suspect there might be issues with both the sending and receiving functions of “spidev_test”?

Teacher “KevinFFF” has been very busy recently and is responding to messages slowly. Due to the urgency of the project, I am posting this again here. I hope other teachers from NVIDIA can help me solve this problem. It’s very urgent.

Hi 403199668,

I don’t see you’ve configured the pinmux for SPI related pins before use.
The steps shared in Jetson/L4T/peripheral/ - eLinux.org have been verified working from us.
I will suggest you using the pinmux spreadsheet to configure the pinmux first.

Teacher:
Your judgment is correct, but I have doubts about setting PINMUX in EXCEL. I have also asked this question in other posts, maybe there were too many replies and you didn’t see it.
If I were to conduct a circuit test, I would have to set the external SPI1 (internal SPI3) to SLAVE mode, so SPI3_MISO would become the output port and SPI3_MOSI would become the input port. However, the corresponding function cannot be found in the “Customer Usage” section of EXCEL, as shown in the following figure for details.

How should I set it up? Can you set both SPI to MASTER mode, cross connect the MISO line, and then test?

teacher:
Have I considered too much? If I treat SPI0 and SPI1 as MASTER mode and only modify the blue part, the final result is as follows. Is it okay to set it this way?

Teacher:
I remember testing SPI in Nvidia Devkit without the need to configure PINMUX using EXCEL But when I tested it in Nvidia Devkit, SPI0_MOSI, SPI0_CS0, and SPI0_SLK all did not emit waveforms.
Is it necessary to use Excel to configure Pinmux while testing SPI in Nvidia Devkit?


Please configure them as above in pinmux spreadsheet first.

You need to short SPI0_MISO and SPI0_MOSI externally before running spidev_test tool to verify SPI loopback test.

For the devkit, you can also use jetson-io tool instead.

Teacher, this is the master mode of SPI. How to set the slave mode?

For SPI slave, you can configure it as following:

Before connecting SPI1(Master) and SPI3(Slave), it’s best to run a loopback test on each interface separately to ensure they are functioning correctly.

Teacher, your Excel spreadsheet is a bit different from mine. I have set it like this and would appreciate your help in confirming it.

It seems the SODIMM PIN# in your case is different from mine.

What’s the file name of your pinmux spreadsheet?
Are you using Orin NX/Nano?

Teacher:
1.Yes, I am using the Orin Nano 4GB core board;
2.the Excel name is this “Orin_Jetson_Series_Pinmux_Config_Template-v2.1.xlsm”. You sent me the email last time.

Please download the pinmux spreadsheet for Orin NX/Nano(https://developer.nvidia.com/downloads/jetson-orin-nx-and-orin-nano-series-pinmux-config-template) from Jetson Download Center.

This one is for AGX Orin rather than Orin NX/Nano.
I sent you that one to indicate the column with more information for Jetson.GPIO tool.
To generate the pinmux/gpio dtsi for Orin NX, please re-download the correct pinmux spreadsheet for Orin NX/Nano.

Alright, thank you, teacher. I’ll download it right away.

Teacher:
I read the link above and found the file . conf. com mon (see Figure 1), but I found many. conf. com mon in Jetpack 5.15 (see Figure 2). I’m not sure which file. conf.common refers to.
I think it’s file p3767.conf.common and file p3768.conf.common, right?

                                   (Figure 1)

                                 (Figure 2)

my understanding of the configuration steps is as follows. Is that correct?

  1. Execute the following program:

  2. Define environment variables in Board.exe:

    file“Board.conf”refers to file“jetson-orin-nano-devkit.conf”;
    
  3. Add parameter references in. conf.common:

     file"<xxx>.conf.common” refers to file“p3767.conf.common"and file "p3768.conf.common”;
    
  4. Use the following command to burn the program:

    $ sudo ./flash.sh <board> mmcblk0p1

Am I understanding correctly?

Teacher:
I feel confused now. If I continue to experiment on NV devkit, there is nothing more to verify on my end.
I think we can only experiment on customized development boards now, and I hope the teacher can give me some guidance as soon as possible. Otherwise, I wouldn’t have continued.
What other ideas does the teacher have? I can fully cooperate on my end.

Please check the board config used to flash the board and the exact XXX.conf.common board config will be sourced.

There’s no internal eMMC for your Orin NX/Nano module.

Is the custom carrier board designed by you or your collegue?
I suggest using the devkit because it can help to reduce the difference between us.
You need to know the workflow for SPI before use them on your board.
It seems you still not clear about how it works like board configuration, pinmux, device tree…etc.

Please check the board config used to flash the board and the exact XXX.conf.common board config will be sourced.

Answer:How to check? Can you briefly explain the process?

Is the custom carrier board designed by you or your collegue?

Answer:This is what I designed, but I referenced previous product and hardware manuals.

I suggest using the devkit because it can help to reduce the difference between us.

Answer:But I have already completed the work that can be done on Nvidia Devkit. I don’t know what to do next.

You need to know the workflow for SPI before use them on your board.
It seems you still not clear about how it works like board configuration, pinmux, device tree…etc.

Answer:Do I need to see those materials? The NVIDIA Jetson Linux Developer Guide is written too simply, I have read it repeatedly, but still cannot fully understand it.

I think you should spend more time guiding me to complete this task now for three reasons:

  1. The SPI debugging time is too long. Nvidia is a large company, so we should pay attention to the impact. Mutual benefit is the key to making the product go further;

  2. My level is definitely not at the bottom of the industry. I have also completed many famous projects and communicated with many clients. To be honest, I have never been so slow.

  3. If everything is slow due to my own reasons, how can you use your products if there are many people who are worse than me? Can’t everyone who drives a car be required to design a car?
    Nvidia’s products are guaranteed to the company by me, and they will not affect the progress and will be absolutely stable. I trust your company and it should provide me with maximum support so that I can further promote your products in the future. What do you think?

Can you reply to messages faster, no matter what, and push things forward? I’m not doing anything now, just waiting for your message and cooperating with you professionally.

The board config is specified in the flash command.
Do you refer to our developer guide for flash?
Flashing Support — NVIDIA Jetson Linux Developer Guide 1 documentation

T234 is different from other series like T210, T186, T194…etc.
Please refer to the documents for T234 to design your custom carrier board.

You have verified SPI loopback(configured with SPI master) test on the devkit.
But I don’t see you verifying SPI1 as master and SPI3 as slave with successful transaction.

Not just the developer guide. There’s the step-by-step guide in elinux page and also many document like the design guide for custom carrier board, application note for pinmux…etc.