Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

interrupts (Zynq)

Posted by eve-shadow on September 12, 2017

Hi, I'm new to FreeRTOS and am trying to build an application on a Zynq device. I'm using the board support package and example code built into Xilinx SDK. The example code runs fine, but now I'm trying to integrate interrupts into the system.

What is the recommended way to initialize interrupts? Should I use the built in Xilinx drivers (SCUGIC), or are there FreeRTOS functions I should call to setup interrupts / handler functions?

In the port code (portZynq7000.c), there is a FreeRTOS_SetupTickInterrupt() function implemented which intializes the ScuGic. I have seen suggestions in other posts that this function/file needs to be changed in order to initialize interrupts for your application. To me this doesn't really make sense though since you shouldn't need to edit your BSP for each application.

So how should I setup interrupts?

Any thoughts appreciated.

Thanks!!


interrupts (Zynq)

Posted by richard_damon on September 12, 2017

It has been a bit since I worked on the Zynq, but as I remember, I changed the FreeRTOS_SetupTickInterrrupt()) function to check if the interrupt controller was already initialized, and use the already setup one if it has been. I did use the low level BSP routines to set up the interrupts.

Just because a chip manufacture provides a Port Layer, doesn't mean it was done well. Because their routine initializes the control while setting up the tick, which happens in the call to start the FreeRTOS Scheduler, any interrupts setup previously are forgotten, so you need to configure your interrupts after the interrupts system is enabled, which in my mind is too late.


interrupts (Zynq)

Posted by rtel on September 12, 2017

The following may help: http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html


interrupts (Zynq)

Posted by eve-shadow on September 12, 2017

Ok thanks. So in what function should my interrupt handling logic go? FreeRTOS_SetupTickInterrupt()?

I'm just a bit confused about how the system is supposed to be architected since it isn't really talked about in the freertos reference or tutorial documents. Is there a document that discusses these topics?

Thanks


interrupts (Zynq)

Posted by rtel on September 12, 2017

Did you see the link I just sent?


interrupts (Zynq)

Posted by eve-shadow on September 12, 2017

Yes I checked that out but am still a bit confused. It talks in the "Interrupt handling" section about the vApplicationIRQHandler. So my understanding is that this function is called when an interrupt occurs, then it should be implemented such that it calls the user's interrupt handler. Is this correct?

If that's the case, I still need to figure out how to register my function with the Xilinx port's GIC. This is the portion I'm mostly confused about. I can post some of the Xilinx port code if that would help.

Thanks


interrupts (Zynq)

Posted by rtel on September 12, 2017

Yes I checked that out but am still a bit confused. It talks in the "Interrupt handling" section about the vApplicationIRQHandler. So my understanding is that this function is called when an interrupt occurs, then it should be implemented such that it calls the user's interrupt handler. Is this correct?

Yes.

If that's the case, I still need to figure out how to register my function with the Xilinx port's GIC. This is the portion I'm mostly confused about. I can post some of the Xilinx port code if that would help.

You can use the Xilinx drivers. The following file has examples of timer interrupts being enabled. You can see where XScuGic_Connect() is installed.

https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Demo/CORTEXA9ZynqZC702/RTOSDemo/src/FullDemo/IntQueueTimer.c


interrupts (Zynq)

Posted by eve-shadow on September 13, 2017

For the benefit of anyone else running into this problem:

In the Xilinx FreeRTOS (9.0.1) BSP, there is a file portZynq7000.c. This file contains a global definition of the interrupt controller

XScuGic xInterruptController;

I was able to get interrupts working by declaring in my code:

extern XScuGic xInterruptController;

You need to initialize it using the usual XScuGicCfgInitialize and then you can connect your interrupt handlers with XScuGicConnect & XScuGic_Enable before vTaskStartScheduler().

Thanks all for the help.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS