[Zhengdian Atomic Alpha IMX6ULL Linux Development Board] 7. SPI function test
[Copy link]
Atom provides a wealth of development documents and examples for us to learn. These materials are open source and free to download, and are very detailed:
This time, the SPI driver was tested. Because the system used in Atom Brother's documentation tutorial is somewhat different from the factory system, problems occurred when directly testing some drivers.
Before compiling, enable the factory cross-compilation tool and check the version number:
source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
arm-poky-linux-gnueabi-gcc --version
Then modify the script of the spi example and change the kernel directory to the directory of the factory system:
Enter the following command to compile the driver module file: make
After successful compilation, a driver module file named "icm20608.ko" will be generated.
Enter the command to enable hardware floating point compilation icm20608App.c test program: arm-linux-gnueabihf-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard icm20608App.c -o icm20608App After successful compilation, icm20608App will be generated. Copy the compiled icm20608.ko and icm20608App files to the rootfs/lib/modules/4.1.15 directory through nfs, restart the development board, and enter the directory lib/modules/4.1.15:
Enter the command to load the icm20608.ko driver module:
depmod //This command needs to be run when the driver is loaded for the first time
modprobe icm20608.ko //Load the driver module
After the driver module is loaded successfully, use icm20608App to test it and enter the following command:
./icm20608App /dev/icm20608 The test APP will continuously read data from ICM20608 and then output it to the terminal, as shown in the figure:
Subsequent research uses the SPI application layer API to read sensor data.
|