Quality RTOS & Embedded Software

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


Loading

Queue receive used from a Task

Posted by Ananda Kumar B on April 18, 2011
Hi,

Currently I'm working on a project that uses Cortex-M3 microcontroller and FreeRTOS.

Recently, I found a bug that causes a crash here:

list.c file:
-----------
for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )
{

}

When it is crashed at this point, the call stack shows likes this:



vListInsert
vTaskPlaceOnEventList
prvUnlockQueue
TskHandler

In the task handler, xqueuereceive function is used to get the message which is posted based on the interrupt.

Can anyone tell, why this is crashed after calling xqueuereceive()?

Regards,
Ananda

RE: Queue receive used from a Task

Posted by Richard on April 18, 2011
From experience of answering this question, I would say it is almost certain that you have your interrupt priorities and configuration set incorrectly.

See the documentation page for the port you are using, the descriptions of configKERNEL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY in the customisation section of the web site and in the Cortex-M3 edition of the FreeRTOS tutorial book, and item three here: http://www.freertos.org/FAQHelp.html

Regards.

RE: Queue receive used from a Task

Posted by Ananda Kumar B on April 18, 2011
Thanks for your quick reply..

For your information.. our application has the kernel & Max_Syscall priority as follows:
#define configKERNEL_INTERRUPT_PRIORITY 255
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191

And i am using two interrupt service routine, which has the interrupt priority level set to 192 & 193 respectively for ISR1 & ISR2. These two ISRs will call "FromISR" API.

But with the above priority settings, still i see the crash is happening at the infinite for loop
for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )
{

}

Can you please tell me whether the above ISRs interrupt priority is proper or not.?

RE: Queue receive used from a Task

Posted by Richard on April 18, 2011
Which microcontroller are you using (I know it's a Cortex-M3, but which).

Do you have the priority grouping set such that all the priority bits are set as being pre-emption priority, and not sub-priority?

Regards.

RE: Queue receive used from a Task

Posted by Ananda Kumar B on April 19, 2011
I am using STM32 microcontroller(Medium density VL) for our project and
For the 1st ISR,
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 192;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

for the 2nd ISR,
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 193;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

This is how the pre-emption priority & sub priority were initialized in our project.

Regards,
Ananda

RE: Queue receive used from a Task

Posted by woops_ on April 19, 2011
Do you call NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ) in your set up routine. That sets how many bits are used for each before you set actual interrupts like in your code. As well, there are only 4 upper bits so 192 and 193 will end with the same priority.

RE: Queue receive used from a Task

Posted by Ivan on April 25, 2011
Hi,

Just to chime in ... I've gotten stuck here before when using FreeRTOS v6.1.0 on an RX62N. The reason for being stuck in the infinite loop here was there one of my tasks was not allocated enough stack space.

You might want to check the memory map of your Task just in case.

Cheers,
Ivan


[ 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