Quality RTOS & Embedded Software

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


Loading

Zynq + FreeRTOS interrupt problem

Posted by devil1989 on June 29, 2017

Hello,

I am using a Zynq-7000 with FreeRTOS and some custom hardware IPs inside the FPGA. Those IPs send interrupts to the ARM core but I have some problems while handling them. The interrupt routine is correctly called after receiving the interrupt but, as soon as it executes "xQueueReceiveFromISR()", I get two errors an the execution stops.

The errors are: Assert failed in file port.c, line 539 Assert failed in file port.c, line 424

The first error is related to the following function, in particular to the first "configASSERT()": ~~~ void vPortValidateInterruptPriority( void ) { /* The following assertion will fail if a service routine (ISR) for an interrupt that has been assigned a priority above configMAXSYSCALLINTERRUPTPRIORITY calls an ISR safe FreeRTOS API function. ISR safe FreeRTOS API functions must only be called from interrupts that have been assigned a priority at or below configMAXSYSCALLINTERRUPTPRIORITY.

	Numerically low interrupt priority numbers represent logically high
	interrupt priorities, therefore the priority of the interrupt must
	be set to a value equal to or numerically *higher* than
	configMAX_SYSCALL_INTERRUPT_PRIORITY.

	FreeRTOS maintains separate thread and ISR API functions to ensure
	interrupt entry is as fast and simple as possible. */
	configASSERT( portICCRPR_RUNNING_PRIORITY_REGISTER >= ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) );

	/* Priority grouping:  The interrupt controller (GIC) allows the bits
	that define each interrupt's priority to be split between bits that
	define the interrupt's pre-emption priority bits and bits that define
	the interrupt's sub-priority.  For simplicity all bits must be defined
	to be pre-emption priority bits.  The following assertion will fail if
	this is not the case (if some bits represent a sub-priority).

	The priority grouping is configured by the GIC's binary point register
	(ICCBPR).  Writting 0 to ICCBPR will ensure it is set to its lowest
	possible value (which may be above 0). */
	configASSERT( ( portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS ) <= portMAX_BINARY_POINT_VALUE );

}

~~~

The second error is related to the following function, in particular to the last "configASSERT()": ~~~ void vPortEnterCritical( void ) { /* Mask interrupts up to the max syscall interrupt priority. */ ulPortSetInterruptMask();

/* Now interrupts are disabled ulCriticalNesting can be accessed
directly.  Increment ulCriticalNesting to keep a count of how many times
portENTER_CRITICAL() has been called. */
ulCriticalNesting++;

/* This is not the interrupt safe version of the enter critical function so
assert() if it is being called from an interrupt context.  Only API
functions that end in "FromISR" can be used in an interrupt.  Only assert if
the critical nesting count is 1 to protect against recursive calls if the
assert function also uses a critical section. */
if( ulCriticalNesting == 1 )
{
	configASSERT( ulPortInterruptNesting == 0 );
}

} ~~~

Does anyone have any idea of what the problem may be? Thanks.

Enrico


Zynq + FreeRTOS interrupt problem

Posted by rtel on June 29, 2017

http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html#interrupt-priorities


Zynq + FreeRTOS interrupt problem

Posted by devil1989 on June 29, 2017

Thanks for the link.

As the link says, "configINTERRUPTCONTROLLERCPUINTERFACEOFFSET" should be equal to 0x1000. In my BSP that #define is ( -0xf00 ). Could it be a problem?

Moreover, I understood that the priority of my interrupts should be lower than configMAXAPICALLINTERRUPTPRIORITY (that is 18 in my case), but I do not know how to check/change their priority. Is there a function to do that?

Thanks for the help! Enrico


Zynq + FreeRTOS interrupt problem

Posted by devil1989 on June 30, 2017

Problem solved.

When interrupts are initialized, after "XScuGicConnect()", you should call "XScuGicSetPriorityTriggerType(XScuGic *InstancePtr, u32 IntId, u8 Priority, u8 Trigger)" and set the priority of each interrupt ( Priority = *yourpriority << portPRIORITYSHIFT*).

Thank you all! Enrico


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner