How to Make SPI Demo¶
1. Introduction¶
This is a demo to show how to get the data of BMI160 by SPI ioctl in ROScube Pico.
The data includes:
CHIP ID
PMU STATUS
SENSOR DATA (ACCEL and GYRO).
Note
In this BMI160 demo, by using /dev/spidev2.0
.
2. Build¶
Download the code from Github Adlink-ROS/bmi160_spi_demo.
git clone https://github.com/Adlink-ROS/bmi160_spi_demo.git
cd bmi160_spi_demo
1. Usage¶
Test the demo following the command.
Compile the code by gcc
gcc -o bmi160_test main.c bmi160.c
Run the code
./bmi160_test
Result
If successfully worked, it will show data:
CHIP ID:
0xD1
PMU STATUS:
0x14
SENSOR DATA: 50 points
Note
It will show OK message on the first line, that means bmi160_perform_self_test
was successful.
Warning
When occurred filed or error, please check the Error Value from bmi160.h.