Quality RTOS & Embedded Software

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



Posted by Tekkon on December 27, 2011
Hi All,

I have an application running on the LM3S8962. The CANBus interrupt service routine grabs the incoming CAN message and calls xQueueSendFromISR() to send out the message to CANRx_Task, which is dealing with processing CAN message. The application runs very good in the first 20 minutes, the CANRx_Task can receive the message and process it immediately. But after 20 minutes, the task has been blocked due to the xQueueSendFromISR() returns errQUEUE_Full in the CAN_ISR. I tried to bump up the queue size from 40 to 80, still got the problem. Can anybody give me some advice how to implement xQueueSendFromISR() for the CANBus ISR and Task, and avoiding errQUEUE_FULL?

Thank you!!!


RE: xQueueSendFromISR

Posted by MEdwards on December 27, 2011
When the task unblocks, does it take out all the messages that are in the queue, or just 1? Is the priority of the task that drains the queue high enough? Have you looked at how many messages are in the queue as the application runs to see when they start backing up? Are you yielding using portEND_SWITCHING_ISR in the interrupt handler to make sure the task that drains the queue runs as soon as possible?

RE: xQueueSendFromISR

Posted by Richard Damon on December 28, 2011
My first guess is that there may be a problem with how you have defined your interrupt routines and you are corrupting the queue structure. Make sure that the priority of the interrupt task is proper for the port (I am not familiar with this family). Also, make sure that the task does NOT call a FromISR routine to get the data.

The 20 minute time period really sounds like it is something "random" causing the problem, and a bad interrupt nesting might be a cause.

Another possibility is that for some reason the CANRx_Task is hung up on some other call and not able to get back to reading from the queue. Are there any other blocking calls that it makes that could do this?

Also, do you use the heap in your program during run time? One problem with this is that if you are not careful, sometimes your program will run out of memory due to leaks or fragmentation and cause things to hang up.

RE: xQueueSendFromISR

Posted by Tekkon on December 28, 2011
Thank you guys for your help. The queue turns into full all in a sudden, I I guess that's something in the task that messed up the queue structure. After I turned off the application layer callback function(which call the upper level function to process received CAN message) in the CANRx_Task, the CAN_ISR, the queue and the task is running good so far(almost 6 hours).

Currently, the CAN interrupt is the only ISR has been enabled, and has been set to a high priority at 1. And the CAN_ISR is the only source to block/unblock the CANRx_Task. The CANRx_Task also has the highest priority.

RE: xQueueSendFromISR

Posted by Richard on December 28, 2011
“Currently, the CAN interrupt is the only ISR has been enabled, and has been set to a high priority at 1.”

Please read item three here: http://www.freertos.org/FAQHelp.html It sounds like your priority configuration is incorrect unless you have configMAX_SYSCALL_INTERRUPT_PRIORITY also set to (the equivalent of) 1.

...and read the "Interrupt Service Routines" section of the documentation page that goes with your port.

[ 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.


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


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