SPRAD26 April   2022 AM67 , AM67A , AM68 , AM68A , AM69 , AM69A , DRA821U , DRA821U-Q1 , DRA829J , DRA829J-Q1 , DRA829V , DRA829V-Q1 , TDA4AEN-Q1 , TDA4AH-Q1 , TDA4AL-Q1 , TDA4AP-Q1 , TDA4APE-Q1 , TDA4VE-Q1 , TDA4VEN-Q1 , TDA4VH-Q1 , TDA4VL-Q1 , TDA4VM , TDA4VM-Q1 , TDA4VP-Q1 , TDA4VPE-Q1

 

  1.   Trademarks
  2. 1SPI: Serial Peripheral Interface
  3. 2J7200/J721e MCSPI Support
    1. 2.1 MCSPI Features
  4. 3SPI: Master Mode Enabling and Validation on Linux
    1. 3.1 Enable SPI Instances of J721e/TDA4VM
    2. 3.2 Enable SPIDEV on TD4VM SDK
    3. 3.3 Exercise SPI From User Space on TI J7/TDA4x Using Standard Linux spidev_test Tool
  5. 4SPI: Slave Mode Enabling and Validation on Linux
    1. 4.1 Enable SPI Instances of J7200
    2. 4.2 Enable DMA for MCSPI4 Slave Node
    3. 4.3 Enable SPIDEV and SPI_SLAVE Configs
    4. 4.4 Test SPI Slave Functionality From User Space on TI J7200 Using Standard Linux spidev_test Tool
    5. 4.5 SPI Slave Testing Using spi-slave-time
    6. 4.6 Linux SPI Slave Challenges
    7. 4.7 Linux SPI Slave Mode General Limitations
    8. 4.8 McSPI SPI Slave Mode Limitations
  6. 5References

Exercise SPI From User Space on TI J7/TDA4x Using Standard Linux spidev_test Tool

The Linux kernel provides spidev_test tool. We need just build & use that. Follow the instructions here:

cd ti-processor-sdk-linux-automotive-j7-evm-*/board-support/linux-*/tools/spi
make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu-
cp spidev_test /media/$user/rootfs/home/root

The above should build spidev_test binary in the tools/spi folder and copy that to rootfs of your target filesystem.

Basic test on TDA4VM Linux command prompt:

cd /home/root
./spidev_test -v -D /dev/spidev6.0 -p "HELLOWORLD"

Output:

spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | 48 45 4C 4C 4F 57 4F 52 4C 44 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |HELLOWORLD|
RX | FF FF FF FF FF FF FF FF FF FF __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |..........|

Since there is no Slave the RX we always see 0xFF.