Personal tools

Difference between revisions of "How to interface ST L3GD20 gyroscope with the VisionSOM-6ULL"

From SomLabs Wiki

Jump to: navigation, search
(Created page with "{{PageHeader|How to interface ST L3GD20 gyroscope with the VisionSOM-6ULL}} == Description == [https://kamami.pl/kamod-kamami/557724-kamodl3gd20-modul-zyroskopu-mems-z-ukladem...")
 
Line 19: Line 19:
  
 
== Hardware set-up ==
 
== Hardware set-up ==
Firstly, make sure the jumpers J6 and J7 are both set to positions 1-2:
 
 
[[File:FRDM-STBC-AGM01_jumpers.png|center|200px]]
 
 
 
Connect the KAmodL3GD20 module according to the photo below:
 
Connect the KAmodL3GD20 module according to the photo below:
  
Line 28: Line 24:
  
 
== Reading the values ==
 
== 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
  
To run the gyroscope, you need to enable it:
+
Now, it's time to run the application. The readings of three axis values from L3HGD20 chip will be displayed after executing:
<pre>root@localhost:~# cd fxas2100x
 
root@localhost:~/fxas2100x# ./fxas2100x_enable.sh
 
[ 1470.052799] misc FreescaleGyroscope: mma enable setting active </pre>
 
  
and then, you should build and run the test application:  
+
root@localhost:~/linux-academy/2-8# ./gyro-i2c
 +
Any move of the sensor board will be related with the readings changes:
  
<pre>root@localhost:~/fxas2100x# make
+
 
make: Warning: File 'Makefile' has modification time 2963329 s in the future
+
[[File:VisionCB_KAmodL3GD20_03.JPG|center|800px]]
cc -Wall -O0 -g -funsigned-char -I.  -c fxas2100x.c -o fxas2100x.o
 
cc -g -O0 -Wl,--gc-sections,--relax -L/usr/local/lib -lnfc_nci_linux -lpthread fxas2100x.o -o gyro-i2c
 
make: warning:  Clock skew detected.  Your build may be incomplete.
 
</pre>
 
Now, it's time to run the application. The readings of three axis values will be displayed after executing:
 
<pre>
 
root@localhost:~/fxas2100x# ./gyro-i2c
 
0.0 0.0 0.0
 
0.1 0.0 -3.0
 
-0.3 0.3 -6.9
 
^C
 
root@localhost:~/fxas2100x#
 
</pre>
 
Any move of the sensor board will be related with the readings changes:
 
[[File:FRDM-STBC-AGM01_readings.png|center|800px]]
 

Revision as of 22:19, 26 July 2018

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.

VisionCB KAmodL3GD20 01.jpg

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:

VisionCB KAmodL3GD20 02.JPG

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:


VisionCB KAmodL3GD20 03.JPG
NXP Partner ST Partner Renesas Partner