| 6 - SPI Operations
1. Connect the ADXL345 module to the 40-pin header as the following:
Figure 6-5 Connect ADXL345 Module to the Header
1
3
5
7
9
11
17
19
23
27
31
35
13
15
21
25
29
33
37
39
2
4
6
8
10
12
18
20
24
28
32
36
14
16
22
26
30
34
38
40
5V Power
5V Power
GND
GPIO5 (UART TX)
GPIO6 (UART RX)
GPIO38
GPIO51
GND
GPIO49 (SPI CE0)
GPIO40
GPIO46 (PWM0)
GPIO36
GND
GPIO54
GPIO50
GPIO56
GND
GND
GPIO61
GPIO44
3.3V Power
GPIO58 (I2C SDA)
GPIO57 (I2C SCL)
GPIO55
GND
GPIO42
3.3V Power
GPIO52 (SPI MOSI)
GPIO48 (SPI SCLK)
GPIO45
GPIO39
GPIO63
GPIO43
GPIO47
GPIO53 (SPI MISO)
GND
GPIO37
GPIO59 (PWM1)
GPIO60
GND
CS
SCLK
MOSI
GPIO
5V
GND
3V3
MISO
ADXL345
2. Locate to the following path for 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:
23
© 2018-2022 StarFive Technology
All rights reserved
StarFive