SoCKit User Manual
80
www.terasic.com
December 1, 2015
The following statement can be used to read the content of
gpio_ext_porta
register. The bit mask is
used to check the status of switches and keys.
alt_read_word( ( virtua
( ( uint32_t )( ALT_GPIO2_EXT_PORTA_ADDR ) &
( uint32_t )( HW_REGS_MASK ) ) ) );
.
Demonstration Source Code
Build tool: Altera SoC EDS V13.1
Project directory: \Demonstration\SoC\hps_gpio
Binary file: hps_gpio
Build command: make ('make clean' to remove all temporal files)
Execute command: ./hps_gpio
Demonstration Setup
Make sure BOOTSEL[2:0] = 101 (Boot from SD card)
Make sure CLKSEL[1:0] = 00
Make sure MSEL[4:0] = 00001
Connect the USB cable to the USB-to-UART connector (J4) on the SoCKit 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 SoCKit board.
Power on the SoCKit board.
Launch PuTTY to connect to the UART port of SoCKit board and type "
root
" to login Altera
Yocto Linux.
In the UART terminal of PuTTY, execute "
./hps_pio
" to start the program.
Press H_KEY0, H_KEY1, H_KEY2, and H_KEY3 will light up LED0, LED1, LED2, and
LED3, respectively. Move H_SW0, H_SW1, H_SW2, and H_SW3 to UP position will light up
LED0, LED1, LED2, and LED3, respectively. Press "CTRL + C" to terminate the application.