
DE10-Standard
User Manual
98
www.terasic.com
January 19, 2017
DATAY1(0x35), DATAZ0(0x36), and DATAX1(0x37) registers. The DATAX0 represents the least
significant byte and the DATAX1 represents the most significant byte. It is recommended to
perform multiple-byte read of all registers to prevent change in data between sequential registers
read. The following statement reads 6 bytes of X, Y, or Z value.
read(file, szData8, sizeof(szData8)); // where szData is an array of six-bytes
Demonstration Source Code
Build tool: SoC EDS v16.1
Project directory: \Demonstration\SoC\hps_gsensor
Binary file: gsensor
Build command: make ('make clean' to remove all temporal files)
Execute command: ./gsensor [loop count]
Demonstration Setup
Connect a USB cable to the USB-to-UART connector (J4) on the DE10_Standard board and the
host PC.
Copy the executable file "
gsensor
" into the microSD card under the "
/home/root
" folder in
Linux.
Insert the booting microSD card into the DE10_Standard board.
Power on the DE10_Standard board.
Launch PuTTY to establish connection to the UART port of DE10_Standard board. Type "
root
"
to login Yocto Linux.
Execute "
./gsensor
" in the UART terminal of PuTTY to start the G-sensor polling.
The demo program will show the X, Y, and Z values in the PuTTY, as shown in
Figure 6-8
.
Figure 6-8 Terminal output of the G-sensor demonstration
Press "CTRL + C" to terminate the program.
6
6
.
.
4
4
I
I
2
2
C
C
M
M
U
U
X
X
T
T
e
e
s
s
t
t
The I2C bus on DE10-Standard is originally accessed by FPGA only. This demonstration shows