Loopback Test

The following steps are provided for the loopback test:

  1. Wiring: Connect Pin19 with Pin 21 as the following:
    Figure 1. Connect Pin 19 with 21
  2. Locate to the following path for the test tool, spidev_test.c:
    cd /linux/tools/spi
  3. Execute the following command under the test tool directory:
    make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv
    Result:

    The output file is spidev_test in the same directory.

  4. Upload spidev_test to VisionFive 2, and change the execution permission by executing the following:
    chmod +x spidev_test
  5. Confirm the SPI device.
    ls /dev/spidev*

    Result:
    Figure 2. Example Output

    In this output, spidev1.0 is the device name.

  6. Execute the following command to perform the test:
    ./spidev_test -D /dev/spidev1.0 -v -p string_to_send
    Tip:

    spidev1.0 is the device name got from the previous step.

    Result:

    Figure 3. Example Output

    In this figure, the TX and RX output are the same, which indicates the test is successful.