I enabled /dev/spi3.0 in TX2, but unable to send/receive data

Below is my system information and I am trying to enable communication using SPI protocol but unable to do so.

deepak@tx2:/boot/dtb$ cat /etc/nv_tegra_release | grep release

R32 (release), REVISION: 2.1, GCID: 16294929, BOARD: t186ref, EABI: aarch64, DATE: Tue Aug 13 04:45:36 UTC 2019

deepak@tx2:~$ uname -a

Linux tx2 4.9.140 #0 SMP PREEMPT Tue Nov 26 17:45:07 AEDT 2019 aarch64 aarch64 aarch64 GNU/Linux

I followed the below steps to enable /dev/spidev3.0

  1. built custom kernel on target using the steps in this link https://elinux.org/Jetson/TX2_SPI but used the sources for 'L4T Sources 32.2.3'. The kernel and modules built successfully
  2. Replaced the image with the built one and installed the modules too. spidev.ko was built successfully.
  3. Modified the device tree and updated the /boot/dtb using the steps provided in the same link. After reboot, I was able to find the /dev/spidev3.0 device
  4. I built the spidev-test from the link https://github.com/rm-hull/spidev-test and ran it with the 19th and 21st pin of the J21 header connected for a loop back test
  5. I got the below result. The rx is not receiving what is sent out.
    spi mode: 0x0
    bits per word: 8
    max speed: 500000 Hz (500 KHz)
    TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
    RX | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  | ................................

    When I tested with oscilloscope, there is nothing being transmitted. Neither the clock or chipselect pins showed any logic changes. The link https://elinux.org/Jetson/TX2_SPI#Modifying_the_Pinmux_Configuration talks about the modification to pinmux config file, but I am unable to find this file. So I didn’t do this step.

    So my questions are

    Why does the SPI show up in the /dev but I am unable to communicate?
    Does the pinmux config file need modification? If so how to do modify it in R32 with target building setup?

Did you modify the pinmux as the wiki said?

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

I was unable to find this file.


I am building the kernel source on the tx2’s SD card. Where do you think I can find it?

It locate at below folder gen by the sdkmanager.