93
Demonstration Setup
Connect the USB cable to the USB-to-UART connector (J4) on the DE1_SoC board and host
PC.
Make sure the executable file "
hps_gpio
" is copied into the SD card under the "
/home/root
"
folder in Linux.
Insert the booting micro SD card into the DE1_SoC board.
Power on the DE1_SoC board.
Launch PuTTY to connect to the UART port of DE1_SoC board and type "
root
" to login Altera
Yocto Linux.
In the UART terminal of PuTTY, execute "
./hps_gpio
" to start the program.
Figure 6-6 Putty window
HPS_LED will flashing 2 times first.
Press HPS_KEY to light up HPS_LED ,Press "CTRL + C" to terminate the application.
6
6
.
.
3
3
I
I
2
2
C
C
I
I
n
n
t
t
e
e
r
r
f
f
a
a
c
c
e
e
d
d
G
G
-
-
s
s
e
e
n
n
s
s
o
o
r
r
This demonstration shows how to control the G-sensor by accessing its registers through the built-in
I2C kernel driver in
Altera Soc Yocto Powered Embedded Linux
.
Function Block Diagram
Figure 6-7
s
hows the function block diagram of this demonstration. The G-sensor on the DE1_SoC
board is connected to the
I2C0
controller in HPS. The G-Sensor I2C 7-bit device address is 0x53.
The system I2C bus driver is used to access the register files in the G-sensor. The G-sensor interrupt
signal is connected to the PIO controller. In this demonstration, we use polling method to read the
register data, so the interrupt method is not introduced here.