Interrupt Creation and Debug on ML403

Similar documents
UART Interrupt Creation on Spartan 3A

System Ace Tutorial 03/11/2008

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University

Spartan-6 LX9 MicroBoard Embedded Tutorial. Tutorial 1 Creating an AXI-based Embedded System

ChipScope Inserter flow. To see the Chipscope added from XPS flow, please skip to page 21. For ChipScope within Planahead, please skip to page 23.

427 Class Notes Lab2: Real-Time Clock Lab

ML410 BSB DDR2 Design Creation Using 8.2i SP1 EDK Base System Builder (BSB) April

Creating the AVS6LX9MBHP211 MicroBlaze Hardware Platform for the Spartan-6 LX9 MicroBoard Version

Module 2: Adding IP to a Hardware Design

System Debug. This material exempt per Department of Commerce license exception TSU Xilinx, Inc. All Rights Reserved

ML410 VxWorks Workbench BSP and System Image Creation for the BSB Design Using EDK 8.2i SP2. April

Virtex-4 PowerPC Example Design. UG434 (v1.2) January 17, 2008

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University

1-1 SDK with Zynq EPP

ML410 VxWorks BSP and System Image Creation for the BSB Design Using EDK 8.2i SP1. April

EDK 7.1 PowerPC Tutorial in Virtex-4

ML410 VxWorks BSP and System Image Creation for the BSB DDR2 Design Using EDK 8.2i SP1. April

LogiCORE IP AXI INTC (v1.04a)

Hello World on the ATLYS Board. Building the Hardware

Spartan-3 MicroBlaze Sample Project

Microblaze for Linux Howto

Discontinued IP. OPB Interrupt Controller (v1.00c) Introduction. Features. LogiCORE Facts

Reference System: Determining the Optimal DCM Phase Shift for the DDR Feedback Clock for Spartan-3E Author: Ed Hallett

Avnet S6LX16 Evaluation Board and Maxim DAC/ADC FMC Module Reference Design

Lab 2: Adding IP to a Hardware Design Lab

Lab6 HW/SW System Debug

Lab 1: Simple Hardware Design

SP601 Standalone Applications

Xilinx ChipScope ICON/VIO/ILA Tutorial

DCR Interrupt Controller (v2.00a)

Building an Embedded Processor System on Xilinx NEXYS3 FPGA and Profiling an Application: A Tutorial

QSPI Flash Memory Bootloading In Standard SPI Mode with KC705 Platform

Module 3: Adding Custom IP to an Embedded System

Reference System: MCH OPB SDRAM with OPB Central DMA Author: James Lucero

EDK Base System Builder (BSB) support for XUPV2P Board. Xilinx University Program

Xilinx Vivado/SDK Tutorial

ML631 U1 DDR3 MIG Design Creation

ML605 Built-In Self Test Flash Application

Spartan-6 LX9 MicroBoard Embedded Tutorial. Tutorial 2 Adding EDK IP to an Embedded System

Reference System: Debugging PowerPC 440 Processor Systems Author: James Lucero

Adding the ILA Core to an Existing Design Lab

Copyright 2014 Xilinx

Spartan-6 LX9 MicroBoard Embedded Tutorial. Tutorial 5 Embedded Chipscope Debugging

Dual Processor Reference Design Suite Author: Vasanth Asokan

and 32 bit for 32 bit. If you don t pay attention to this, there will be unexpected behavior in the ISE software and thing may not work properly!

Quick Start Guide ZedboardOLED Display Controller IP v1.0

SP605 Built-In Self Test Flash Application

Reference System: MCH OPB EMC with OPB Central DMA Author: Sundararajan Ananthakrishnan

Hardware Design Using EDK

University of Massachusetts Amherst Computer Systems Lab 1 (ECE 354) LAB 1 Reference Manual

Benchmarking the Performance of the Virtex-4 10/100/1000 TEMAC System Author: Kris Chaplin

Introduction to Embedded System Design using Zynq

Hardware In The Loop (HIL) Simulation for the Zynq-7000 All Programmable SoC Author: Umang Parekh

University of Toronto ECE532 Digital Hardware Lab 5: Adding a User-Designed Peripheral

CE 435 Embedded Systems. Spring Lab 3. Adding Custom IP to the SoC Hardware Debug. CE435 Embedded Systems

ML410 BSB Design Adding the PLB TEMAC with RGMII Using EDK 8.2i SP1. April

Reference System: PLB DDR2 with OPB Central DMA Author: James Lucero

Laboratory 2(b): Configuring an ADC with MicroBlaze. Authors: Trung N. Tran (National Instruments) Jeff C. Jensen (National Instruments)

Reference Design: LogiCORE OPB USB 2.0 Device Author: Geraldine Andrews, Vidhumouli Hunsigida

Using Serial Flash on the Xilinx Spartan-3E Starter Board. Overview. Objectives. Version 8.1 February 23, 2006 Bryan H. Fletcher

ML631 U2 DDR3 MIG Design Creation

XA Automotive ECU Development Kit

Lab Exercise 4 System on chip Implementation of a system on chip system on the Zynq

SP605 Standalone Applications

Spartan-6 LX9 MicroBoard Embedded Tutorial. Lab 6 Creating a MicroBlaze SPI Flash Bootloader

Lab 3: Adding Custom IP to an Embedded System Lab

HyperBus Memory Controller (HBMC) Tutorial

EDK Concepts, Tools, and Techniques

Spartan -6 LX9 MicroBoard Web Connectivity On Ramp Tutorial

Disassemble the machine code present in any memory region. Single step through each assembly language instruction in the Nios II application.

EDK Concepts, Tools, and Techniques

EDK Concepts, Tools, and Techniques

Zynq-7000 All Programmable SoC: Concepts, Tools, and Techniques (CTT)

SP605 MIG Design Creation

Use Vivado to build an Embedded System

DKAN0011A Setting Up a Nios II System with SDRAM on the DE2

Software Development Advanced

HyperBus Memory Controller (HBMC) Tutorial

F28069 ControlCard Lab1

The Zynq Book Tutorials

POWERLINK Slave Xilinx Getting Started User's Manual

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University

İSTANBUL TECHNİCAL UNIVERSITY ELECTRİCAL ELECTRONICS ENGINEERING FACULTY

Introduction to the Altera SOPC Builder Using Verilog Designs. 1 Introduction

Synaptic Labs (S/Labs) HyperBus Memory Controller (HBMC) Tutorial for Intel FPGA devices

Software Development. This material exempt per Department of Commerce license exception TSU Xilinx, Inc. All Rights Reserved

University of Massachusetts Amherst Computer Systems Lab 2 (ECE 354) Spring Lab 1: Using Nios 2 processor for code execution on FPGA

ML605 Built-In Self Test Flash Application

Using ModelSim in EDK:

Introducing the Spartan-6 & Virtex-6 FPGA Embedded Kits

Xilinx Platform Studio tutorial

Configuring the Xilinx Spartan-6 LX9 MicroBoard

Writing Basic Software Application

As CCS starts up, a splash screen similar to one shown below will appear.

SP601 Built-In Self Test Flash Application

Introduction to Zynq

High Speed Data Transfer Using FPGA

Firstly, lets build the example design that shall be used throughout this tutorial by following the steps below:

APPENDIX A. CODE COMPOSER STUDIO (CCS) v5: A BRIEF TUTORIAL FOR THE DSK6713

Partial Reconfiguration of a Processor Tutorial. PlanAhead Design Tool

Transcription:

Interrupt Creation and Debug on ML403 This tutorial will demonstrate the different debugging techniques used for debugging Interrupt based applications. To show this we will build a simple Interrupt application that will use a push button to create an external interrupt. This application will use the ML403 board. The design will be created using EDK 10.1.03i. Also, Chipscope 10.1i will be used in one of the debugging steps. Step 1: Create the Interrupt Project. To create the project, the Base System Builder (BSB) in XPS will be used. To launch XPS, go to Start -> Run and type XPS, this will launch the XPS tool. Follow the steps seen below to build the BSB design: Select Base System Builder, Press Next to continue. 1

Browse to where you want to save your interrupt project, Press Next to continue. 2

Select I would like to create a new design, Click Next to continue. 3

Select the ML403 Board as shown below, Select Next to Continue 4

Select the Microprocessor, Press Next to Continue. 5

Select 64KB memory for the Local Memory, Press Next to continue. 6

Select the peripherals as shown below, Press Next to Continue. 7

Select the peripherals as shown below, Press Next to Continue. 8

Select the peripherals as shown below, Press Next to Continue. 9

Select Next to continue. 10

In software setup, de-select the button for the two Application, shown below. Press Next -> Generate -> Finish to finish 11

Now that the BSB is built, we can make modification to the hardware. At the moment there are 5 pushbutton inputs. We will modify our hardware so we only have one pushbutton input into the interrupt controller. This makes it easier to demonstrate. To make the modifications, open the MHS file and locate the external ports at the top of the file. This will look like the snapshot seen below: Here we can see that there is an external vector. This vector is named fpga_0_push_buttons_position_gpio_io_pin If you open the UCF file you will notice that this vector is connected to the 5 push buttons on the ML403, This is seen below: 12

The UCF and the MHS will be modified so that only one push button will be input onto an external port. This is shown below: Modified UCF Modified MHS In the modified MHS file the following is added: PORT fpga_0_push_buttons_position_gpio_io_pin = Push_Button, DIR = I, SIGIS = INTERRUPT, SENSITIVITY = EDGE_RISING, INTERRUPT_PRIORITY = LOW The signal has been renamed Push_Button. The Direction, DIR = I as this signal is an input from the push button. The Signal, SIGIS = INTERRUPT as the signal from the push button is an interrupt signal. The sensitivity, SENSITIVITY = EDGE_RISING this tells the interrupt controller to expect an interrupt to occur on a rising edge. Finally, the priority of the interrupt is low, therefore, INTERRUPT_PRIORITY = LOW 13

Next step is to connect the Push_Button to the interrupt controller. Then connect the interrupt controller to the MicroBlaze. This is seen below: Below is a block diagram of the changes seen above: 14

Once all the modifications have been made the GPIO can be deleted from the hardware as it is no longer needed. In System Assembly View, right click on the on the xps_gpio and select Delete Instance In the Pop up box seen below, select Delete instance but keep its ports 15

The next thing to do is to build the software application. This software application will be a simple application to show how to register the interrupt and to register the handler. To create a new application, Click on the Application tab on the left and right click on Add Software Application Project seen below: In the pop-up box, name your Application Interrupt_Test as shown below. Select OK to continue: 16

This will create an empty project for you. To create the source code for the Interrupt_Test application, right click on source in the application and select Add New File This is seen below: Browse to the Interrupt_Test folder, if it isn t there create one making sure you name it correctly. Name the source file Test.c, making sure you use a lower case c for the file. This is seen below: 17

Programming XPS INTC The number of interrupt inputs that a XPS INTC has is set by the C_NUM_INTR_INPUTS generic. The first input is always Int0 and is mapped to the LSB of the registers (except IVR and MER). A valid interrupt input signal is any signal that provides the correct polarity and type of interrupt input. Examples of valid interrupt inputs are rising edges, falling edges, high levels, and low levels (hardware interrupts), or software interrupts if HIE has not been set. The polarity and type of each hardware interrupt input is specified in the XPS INTC generics C_KIND_OF_INTR, C_KIND_OF_EDGE, and C_KIND_OF_LVL. Software interrupts do not have any polarity or type associated with them, so, until HIE has been set, they are always valid. Any valid interrupt input signal that is applied to an enabled interrupt input will generate a corresponding interrupt request within the XPS INTC. All interrupt requests are combined (an OR function) to form a single interrupt request output. Interrupts are enabled individually by dedicated interrupt enable bits and collectively by a master interrupt enable bit. During power-up or reset, the XPS INTC is put into a state where all interrupt inputs and the interrupt request output are disabled. In order for the XPS INTC to accept interrupts and request service, the following steps are required: 1. Each bit in the IER corresponding to an interrupt input must be set to a one. This allows the XPS INTC to begin accepting interrupt input signals. Int0 has the highest priority, and it corresponds to the least significant bit (LSB) in the IER. This is done in the line of code below: XIntc_mEnableIntr(XPAR_XPS_INTC_0_BASEADDR, Push_Button_Mask); 2. The MER must be programmed based on the intended use of the XPS INTC. There are two bits in the MER: the Hardware Interrupt Enable (HIE) and the Master IRQ Enable (ME). The ME bit must be set to enable the interrupt request output. This is done in the line of code seen below: XIntc_mMasterEnable(XPAR_XPS_INTC_0_BASEADDR); 3. Connect the interrupt handler to the Interrupt controller, along with the interrupt information that is connected to the interrupt controller. In this tutorial there is only one interrupt connect to the controller. This code is shown below: XIntc_RegisterHandler(XPAR_INTC_SINGLE_BASEADDR,Push_Button_Interupt, (XInterruptHandler)debug_int_handler,(void *)XPAR_INTC_SINGLE_BASEADDR); 4. Finally, all the interrupt port on the MicroBlaze is enabled to receive interrupts. The code for this is shown below: microblaze_enable_interrupts(); 18

The next step is to copy the code seen below into the empty Test.c file. This code is shown below: Now that the code has been written, the project can be intialized into the BRAMS. To do this right click on the Interrupt_Test application and select Mark to initialize brams This is seen below: 19

Next Generate the Linker script for the Interrupt_Test application. To do this right click on the Interrupt_Test application and select Generate Linker Script Place all sections into the BRAM, this is seen below: The next step is to compile the Libraries and BSP s, to do this select Software -> Generate Libraries and BSP s. Then build the Interrupt_Test application, to do this go to Software -> Build all user applications Now build the bitstream, to do this go to Hardware -> generate bitstream. Now update the bitstream with the software, to do this go to Device Configuration -> Update bitstream. Finally, download the bitstream to the board, to do this go to Device Configuration -> Download bitstream. 20

Using Software Registers to debug interrupt: Now that the system is built we can now test it on the ML403 Board. The first of the debugging techniques we will use is to determine if the software has been written correctly. XMD can be used to determine the state of the registers in the interrupt controller. Below is a list of the registers that can be viewed to determine if your system is working correctly: Interrupt Controller Register Table The first thing we can check is if the interrupt has been enabled on the interrupt controller. This line in Test.c that enables the push_button on the interrupt controller is shown below: To verify that the push_button has been enabled successfully we can check this in the interrupt controller register. By viewing the register table seen above, one can see that that Interrupt Enable Register is located at C_BASEADDR + 0x8. To obtain the Base Address of the interrupt controller go to System Assembly view and click the Addresses tab. Here it can be seen that the interrupt contoller (xps_int_0) is located at 0x81800000 Therefore, the Interrupt Enable Register is located at 0x81800008 21

To view the Interrupt Enable Register, open the XMD, to do this go to Debug -> Launch XMD. Note: You may be prompted to set up your JTAG connection. Select which ever cable you are using and click next to continue. Once, the XMD is open change directory to the Interrupt_Test application, and download the executable.elf file. This is seen below: When it is finished downloading, type run, followed by stop. This is so we can view the registers. Now to view the Interrupt Enable Register, run the following command: The result should be the same as below: This is the expected result as the Push_Button_Mask is set to 0x01 22

Adding Custom IP with Interrupt. You can use the create or import custom peripheral wizard to add a custom IP with interrupt control. Follow the steps below to see this. Step 1: Launch the Create or Import peripheral wizard. Hardware -> Create or import Peripheral. 23

Step 2: Select Create temple for a new peripheral. 24

Step 3: Select to an XPS project. 25

Step 4: name the custom peripheral interrupt_ip 26

Step 5: Select the PLB bus. 27

Step 6: Select Interrupt control, User Logic software register and Include data phase timer. Step 7: Next,, Finish 28

Now that the IP has been created you can add the custom IP to your project. To do this open the IP Catalog and double click on your custom IP. 29

Connect the interrupt_ip to the PLB bus. To do this open the Bus Interface tab and drop the interrupt_ip and select mb_plb. Open the Address tab and select the size to be 64K 30

Open the Ports tab, and drop down the interrupt_ip_0. Select New Connection. This will give the port name interrupt_ip_0_ip2intc_irpt_0 by default. Open the MHS file and scroll down interrupt_ip core and re-name the interrupt signal to Custom_IP_interrupt. 31

Back in the Ports tab, drop down the interrupt controller and click on the Intr port, Highlighted below. Set the priority as seen below. 32

When the core is created using the create or import peripheral wizard a driver is created that you can use. This can be found at \drivers\interrupt_ip_v1_00_a\src.you will need to link this to your application. There is a selftest function INTERRUPT_IP_SelfTest() That can be run to test your interrupt_ip. Simply call this function from within your application. Below is shown how to call this function: You should see the following in the hyperterminal: 33

You can also use this interrupt_ip from within your code this is seen below along with an example handler for the custom_ip. Next, you will have to register the Custom_ip handler, enable the interrupt_ip on the interrupt controller and then enable the interrupt_ip. 34

The next step is to compile the Libraries and BSP s, to do this select Software -> Generate Libraries and BSP s. Then build the Interrupt_Test application, to do this go to Software -> Build all user applications Now build the bitstream, to do this go to Hardware -> generate bitstream. Now update the bitstream with the software, to do this go to Device Configuration -> Update bitstream. Finally, download the bitstream to the board, to do this go to Device Configuration -> Download bitstream. If you look at the custom logic for the interrupt_ip you will see the code that generates the interrupt. 35

You should see a custom interrupt occur every ~10 secs @ 100 Mhz 36

Using Chipscope to Debug: Previously, we have been using the registers to determine if the software was set up correctly. However, to insure that the hardware is correct Chipscope can be used. Chipscope monitors signals mush the same way as an oscilloscope would. It triggers on a signal defined by the user in hardware and takes samples that signal and displays the result on a waveform GUI. The Chipscope uses the JTAG to connect to the device. In this tutorial, Chipscope will be used to monitor the interrupt coming in for the push button. Since the interrupt is sensitive to the rising edge, an interrupt would be expected to occur when the push button is pressed. To add the Chipscope core go to Debug -> Debug Configuration. This is shown below: 37

This will launch the Chipscope GUI (seen below). Follow the next steps to create the Chipscope core: Click Add ChipScope Peripheral This will create another pop up window seen on the next page. 38

Select To monitor arbitrary system level signal (adding ILA) as the interrupt signal will be monitored, Click OK to continue. 39

On the next screen drop down the Available Ports on Instance menu and select External Ports, This is seen below, Click OK to continue. 40

On the next screen, select the fpga_0_push_buttons_posistion. And click << Add This is shown below, Click OK to continue. 41

This will create a Chipscope core that you can see in your MHS file, shown below: This corresponds to the block diagram seen below. The Chipscope core is seen in red. Update the bitstream to include the Chipscope core and download the bitstream to the board. To do this, follow the instructions below: Device Configuration -> Update bitstream. Device Configuration -> Download bitstream. 42

Launch the Chipscope. Open the JTAG Chain, this is seen below, press OK in the pop up window. The following message (seen below) should be seen in the console window, if not go back and make sure the ILA has been added correctly, also, make sure the bitstream has been downloaded. 43

Something similar to the screen seen below should be seen: The Trigger will have to be set-up. Currently the trigger is set up to X. In the Signals window, drop the Data Port as shown below and rename it to Push-Button. In the Trigger Setup window, set the Value to 1 as shown below: 44

Now hit the Play button, shown below: The message seen below should be seen in the in the waveform window; To create an interrupt, hit the SW5 push button on the board. This should send the Pushbutton waveform high. This is shown below: Also, you should see the info message in the console window: This is because the Chipscope is waiting for an update from the user. This is normal behaviour 45