FONT SIZE : AAA
In this exercise a software application will be created that utilises hardware interrupts on the Zedboard. The push buttons will be used to increment a counter by different values, and the count will be continuously displayed on the LEDs in binary form, where LED0 corresponds to the least significant bit (LSB) and LED7 the most significant bit (MSB). This application will run on the Zynq processing systems, communicating with the AXI GPIO blocks implemented in the PL.
The SDK should have opened after the conclusion of Exercise 2B. If it did not open, you can open the SDK by navigating to Start > All Programs > Xilinx Design Tools >Vivado 2013.4>SDK> Xilinx SDK 2013.4 and specifying the workspace as in Exercise 2A.
(a) Select File > New > Application Project from the Menu bar.
(b) The New Project dialogue window will open. Enter interrupt_counter in the Project name field, as shown in Figure 2.20, keeping all other options with the default settings. Click Next.
(c) At the New Project Templates screen, select Empty Application, as in Figure 2.21, and click Finish to create the project.
NOTE: the new project should open automatically. If it doesn’t, you may need to close the Welcome tab in order to view the project.
With the new Application Project created, we can now import some pre-prepared source code for the application.
(d) In the Project Explorer panel, expand interrupt_counter and highlight the src directory. Right click and select Import., choosing General > File System as an import source.
(e) In the Import File System window, click the Browse. button.
(f) Navigate to the directory: C:\Zynq_Book\sources\zynq_interrupts and click OK.
(g) Select the file interrupt_counter_tut_2B.c, as shown in Figure 2.22, and click Finish.
This file contains C Code that has been written to perform the interrupt triggered counter operation on the ZedBoard.
(h) Open the imported source file by expanding the src folder and double-clicking on interrupt_counter_tut_2B.c, and explore the code.
The code has been fully commented, but will be briefly discussed here for clarity. Note that this file contains several portions of code which have been commented out; these will be utilised and discussed further in the next exercise and can be ignored for now.
By now, you should be familiar with the use of drivers and parameters in configuring and operating the GPIO. Remember, detailed information of these drivers can be found in the system.mss file, explaining the purpose of each function and the parameters passed to it. Predesignated parameters can also be found in xparameters.h.
The Zynq PS features a built in interrupt controller, initialised here as XScuGic INTCInst. This handles all incoming interrupt requests passed to the PS and performs the function associated with each interrupt source. It is also capable of prioritising multiple interrupt sources to the requirements of the application.
Of particular note is the inclusion of the function BTN_Intr_Handler(void *InstancePtr);. This is the interrupt handler function for the push buttons and is called every time an interrupt request from the push buttons in the PL is received in the PS. This performs a counter increment on each call and displays the value of the counter on the LEDs in binary.
An initial setup function can be found below the main function. This is InterruptSystemSetup(XScuGic *XScuGicInstancePtr);. The function initialises and configures the interrupt controller in the Zynq PS, connecting the interrupt handler to the interrupt source. It also makes a call to the latter function which enables the interrupt sources and registers exceptions.
The next step is to program the Zynq PL with the bitstream file that we generated in Exercise 2B.
Ensure that the ZedBoard is powered on and that the JTAG port is connected to the PC via the provided USB-A to USB-B cable.
(i) Download the bitstream to the Zynq PL by selecting Xilinx Tools > Program FPGA from the Menu bar. The Program FPGA window will appear. The Bitstream field should already be populated with the correct bitstream file, as in Figure 2.23.
If it is not, enter:
zynq_interrupt_system_wrapper.bit
and click Program.
As in the previous tutorial, once the device has successfully been programmed, the DONE LED on the ZedBoard will turn blue.
With the Zynq PL successfully configured with the bitstream file, we can now launch our software application on the Zynq PS.
(j) Select interrupt_counter in Project Explorer. Right-click and select Run As > Launch on Hardware.
The counter increments by different values based on the push button which is pressed. The counter operates as demonstrated in Figure 2.24.
(k) Try pressing different push buttons and observing how the counter increments (or does it increment at all?) Based on your findings, can you determine the value assigned to each of the push buttons (BTNU, BTND, BTNL, BTNR and BTNC as noted on the ZedBoard)?
You have successfully created and executed a software application utilising interrupts on the Zynq PS. The next step is to go back and add an additional interrupt source with higher priority to alter the functionality of the system.
Manufacturer:Xilinx
Product Categories:
Lifecycle:Active Active
RoHS: -
Manufacturer:Xilinx
Product Categories: FPGAs
Lifecycle:Obsolete -
RoHS: No RoHS
Manufacturer:Xilinx
Product Categories: Memory - Configuration Proms for FPGA's
Lifecycle:Obsolete -
RoHS: No RoHS
Manufacturer:Xilinx
Product Categories:
Lifecycle:Active Active
RoHS: -
Manufacturer:Xilinx
Product Categories: Memory - Configuration Proms for FPGA's
Lifecycle:Active Active
RoHS: -
Support