We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 

Adam Taylor’s MicroZed Chronicles, Part 106: Interrupt Latency Part Two

Xilinx Employee
Xilinx Employee
0 2 119K


By Adam Taylor


With the hardware platform defined and built, we can now progress to creating the software that will determine the interrupt latency on the Zynq SoC’s fIRQ and nIRQ interrupts. Both interrupts are stimulated by AXI Timers. Here, the interrupt latency will be the time required to start executing the ISR, not the time to acknowledge the interrupt and start the processing hence it will be a little longer.


AXI timers are a very useful component within an embedded system. Each timer instance in a Zynq SoC contains two 32-bit counters, which can be configured in the following modes:


  • Generate – The counter counts up or down as selected from a reset value. Once the terminal count is reached, the timer pulses the generate output (if enabled). This mode is used to generate a signal or interrupt at a predefined time interval.
  • Capture – Assertion of the timer’s external Capture Trigger signal stores the value of the counter when the trigger signal is asserted. This mode can be used to measure the duration of external events.
  • PWM – Uses both of the timer’s counters to create a PWM signal. Timer 0 defines the overall period and timer 1 defines the period’s high time.






We will be using both of of the Zynq SoC’s timers in the generate mode (default count up and auto reload mode). To ensure we do not have timing issues caused by interrupts occurring at precisely the same time, both timers will be set for different intervals.


In generate mode, we can determine the interval using the equation below:



Interval = (2^32-1 – Counter Reset Value + 2) * Clk Period



With a clock frequency of 100MHz and using counter reset values of 0xF000 0000 and 0xF8035280, the timers will generate interrupts at 2.684 seconds on nIRQ and 1.339 seconds on fIRQ.


With the timers configured, my first plan as I mentioned last week was to use EMIO GPIO to drive the freeze pin on the AXI Timer and freeze the timer value. To do this the ISR would first assert the freeze pin. It would then calculate the time taken between the timer generating the interrupt and the freeze pin being asserted.


Running the code on the ZedBoard I achieved the following results for the fIRQ and nIRQ stopping the interrupt using the freeze pin:




These results indicate an interrupt latency of approximately 700nsec for both interrupts. However, asserting the EMIO GPIO signal takes a number of cycles, which significantly alters the result. I therefore decided to modify the code slightly.


Instead of driving the freeze pin, I decided instead to read the value on the AXI Timer as soon as the ISR is called. This change alters the results by reducing of the interrupt latency by nearly 150nsec, as shown below:







To demonstrate the impact other system configurations and parameters can have upon the interrupt latency, I decided to disable the processor caches and rerun both tests. This considerably increases the measured latency time for both approaches, as would be expected:





Using the Freeze Input with Caches disabled






Reading the AXI timer with Caches disabled




I have uploaded the code to GitHub.


Next week, we will look at how we can combine this with the XADC to receive an external analog signal.


Incidentally I will be at the Embedded Systems Conference in Minneapolis this week (4-5th November) please come say hello if you are attending.



If you want E book or hardback versions of previous MicroZed chronicle blogs, you can get them below.




  • First Year E Book here
  • First Year Hardback here.



 MicroZed Chronicles hardcopy.jpg



  • Second Year E Book here
  • Second Year Hardback here



MicroZed Chronicles Second Year.jpg 




You also can find links to all the previous MicroZed Chronicles blogs on my own Web site, here.




Tags (1)