| 6 - SPI Operations
6.2.1. Loopback Test
The following steps are provided for the loopback test:
1. Wiring: Connect Pin19 with Pin 21 as the following:
Figure 6-2 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 6-3 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:
21
© 2018-2022 StarFive Technology
All rights reserved
StarFive