Cyclone V Avalon Interrupts Example
A demonstration of how to send an interrupt from the Cyclone V FPGA to the HPS and handle the IRQ in Linux.
Includes Verilog description which triggers interrupt when a switch or push button changes state, as well as Linux kernel sysfs driver and userspace command-line program.
Programming the FPGA
- Go into the fpga directory.
- Open interrupt_example.qpf in quartus.
- Open the soc_system.qsys file in Qsys and generate the system.
- Compile the SOF file and program it onto the FPGA.
Loading the Kernel Driver
- Go into the software/kernel directory and run
- Copy the fpga_uinput.ko file to the SDCard.
- On the HPS, run
echo 1 > /sys/class/fpga-bridge/lwhps2fpga/enable.
- Make sure that the file "/sys/bus/platform/drivers/fpga_uinput/fpga_uinput"
Running the userspace program
- Go into the software/userspace directory and run
- Copy the
readstatebinary to the SD card.
- Run the executable on the HPS.
- Start flipping switches and pushing buttons. The program should print out information when an input changes state.