Overview

The GSRD includes a numbed of sample Linux applications that help demonstrate some of the features of the platform:
  • Display Hello World message
  • Control LEDs
  • Detect interrupts from push buttons and DIP switches
The sample applications can be used as a starting point for users to write their own applications that interact with software IP through Linux drivers.

Prerequisites

1. Boot Linux on the target board as described in Booting Linux. You will not need to use the serial terminal if you plan on using ssh connection.

2. Connect to the board using one of the following options: 3. In serial console, or ssh client console, change current folder to be /home/root/altera- this is where the application binaries are stored.
 # cd /home/root/altera

Display Hello World Message

1. Run the following command to display the Hello World message on the console:
# ./hello 

Exercise Soft PIO Driver for LED Control

The following LEDs are exercised:
LED Number Corresponding Board LED
0 D26
1 D25
2 D28
3 D27
1. In order to blink an LED in a loop, with a specified delay in ms, run the following command:
# ./blink    

  • The led_number specifies the desired LED, and is a value between 0 and 3.
  • The delay_ms is a number that specifies the desired delay in ms between turning the LED on and off.
2. In order to turn an individual LED on or off, run the following command:
# ./toggle    

  • The led_number specifies the desired LED, and is a value between 0 and 3.
  • The state needs to be 0 to turn the LED off, and 1 to turn the LED off.
3. In order to scroll the FPGA LEDs with a specified delay, please run the following command:
# ./scroll_client  

The delay parameter is a numbed the specifies the desired scrolling behavior:
  • delay > 0 - specify new scrolling delay in ms, and start scrolling
  • delay < 0 - stop scrolling
  • delay = 0 - display current scroll delay

Register Interrupt and Call Interrupt Service Routine

In order to register an interrupt handler to a specific GPIO, you will first need to determine the GPIO numbers used.

1. Open the FPGA design and look up the address offsets for the DIP switches and the buttons:
Peripheral Address Offset Address
dipsw_pio 0x00010030 0x100000030
button_pio 0x00010020 0x100000020
Determine which of the GPIO entries from /sys/class/gpio/ matches the offsets by searching for the address in the label entry.

2. For DIP switches, run:
# grep -r "0x100000030" /sys/class/gpio/gpiochip*/label 

The output will be something similar with:
/sys/class/gpio/gpiochip182/label:/sopc@0/bridge@0xc0000000/gpio@0x100000030

This means that the GPIOs 182 .. 185 are allocated to the DIP switches (there are four of them).

3. For push buttons run:
# grep -r "0x100000020" /sys/class/gpio/gpiochip*/label

The output will be something similar with:
/sys/class/gpio/gpiochip186/label:/sopc@0/bridge@0xc0000000/gpio@0x100000020

This means that the GPIOs 186, 187 are allocated to the push buttons (there are two of them).

4. In order to register an interrupt handler to a GPIO interrupt, run the following command:
# modprobe gpio_interrupt gpio_number=

Where gpio_number is one of the numbers determined at the previous steps.

For example run:
# modprobe gpio_interrupt gpio_number=186

User will need to do "rmmod gpio_interrupt" prior in order to change gpio_number by calling "modprobe gpio_interrupt gpio_number=" again

5. Press FPGA push button 0 (s3).

If you are on the serial console, you will see the following message displayed on the console:
Interrupt happened at gpio:186

If you are on the ssh console, you will need to run the program dmesg after pressing the button in order to see the messages:
# dmesg 

System Check Application

System checking application provides a glance of system status of basic peripherals such as:
  • Power management device information : Input Voltage (vin), output voltage (vout1), output current (iout1)
  • USB USB device driver
  • SysID : FPGA system ID
  • Network IP (IPv4) : Network IP address
  • HPS LEDs : HPS LED state
  • FPGA LEDs : FPGA LED state
# ./syschk 

Note: System check application works better when viewed via SSH to the target. USB-UART refreshes slower hence the user interface might flicker.

© 1999-2024 RocketBoards.org by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Privacy Policy - Terms Of Use

This website is using cookies. More info. That's Fine