How to interface ST L3GD20 gyroscope with the VisionSOM-6ULL
From SomLabs Wiki
How to interface ST L3GD20 gyroscope with the VisionSOM-6ULL
Description
KAmodL3GD20 is a gyroscope module with a L3GD20 chip from STMicroelectronics. It allows to measure angular velocity at ±2000 degrees per second.
Prerequisites
This tutorial is based on a pre-prepared image for VisionSOM-6ULL module. The image is available here: SoMLabs-VisionSOM-6ULL-training-02-2018-sdcard-2gb.zip.
Then you need to write the image file to microSD card. More information you can find in manuals: How to prepare SD Card with Debian 9.2 for VisionSOM-6ULL on Linux or How to prepare SD Card with Debian 9.2 for VisionSOM-6ULL on Windows. Please remember to use a proper image file: SoMLabs-VisionSOM-6ULL-training-02-2018-sdcard-2gb.zip.
In the ready-to-use OS image, the kernel driver for the gyroscope has already been enabled in the kernel config, and the device has been added to the devicetree. |
If you need more information about how to customize, build and upload Device Tree file, please visit How to customize Debian 9.2 device tree.
Hardware set-up
Connect the KAmodL3GD20 module according to the photo below:
Reading the values
To run the gyroscope, you need to go to the directory where the example code is located.
root@localhost:~# cd /root/linux-academy/2-8
Now, it's time to run the application. The readings of three axis values from L3HGD20 chip will be displayed after executing:
root@localhost:~/linux-academy/2-8# ./gyro-i2c
Any move of the sensor board will be related with the readings changes: