Quality RTOS & Embedded Software

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



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 ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists