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


problem wth queue between ISR and Task

Posted by Alessio Tognazzolo on March 27, 2010
Hi to all,
i have a big problem: i'm using a queue system to synchronize a task with 2 ISR (one from ethernet and one from timer).ISR unblock task with a binary semaphore. Inside ISR i'm using a queue to create events to insert into it(with xQueueSendFromISR function) and in the task i have a loop blocked with a xSemaphoreTake.Idon't understand why i have a bus fault when i execute the instruction xSemaphoreTake. Thanks in advice for your answer,


RE: problem wth queue between ISR and Task

Posted by Dave on March 27, 2010
Which architecture are you using? Are you basing your project on a provided demo? Have you created the semaphore and the queue before you use them (especially if the interrupt is executing before the scheduler is started)? Is anything working?

RE: problem wth queue between ISR and Task

Posted by Richard Damon on March 27, 2010
If it was created as a semaphore, then the ISR should use xSemaphoreGiveFromISR not xQueueSendFromISR, while Semaphores are built on Queue code, I don't think they are interchangeable (for instance, Semaphores set up the queue for a zero byte object, and the QueueSend may not be set up to handle something like that.

RE: problem wth queue between ISR and Task

Posted by Alessio Tognazzolo on March 27, 2010
i'm using a STM32 architecture with Cortex M3 processor. I creathed both semaphore and queue before enable interrupts.I'm using a queue to simulate a producer-consumer model.Everytime i have an interrupt i insert an element in the queue,after i unblock task that consume elements in the queue. About ISR first i must insert an element on the queue (and i do it with xQueueSendFromISR) and after i do xSemaphoreGiveFromISR and finally before leave ISR i do portEND_SWITCHING_ISR.

RE: problem wth queue between ISR and Task

Posted by Dave on March 27, 2010
Are you totally 100% sure that the priority of the interrupt is equal to or low than configMAX_SYSCALL_INTERRUPT_PRIORITY? On the STM32 for the priority to be lower the value of the priority must be higher (0 is the highest priority and 255 is the lowest priority, so if you don't set the priority it will be 0 by default and therefore the highest possible and this will cause an issue). Also, how the priority is specified depends on the function used to set it. Some need the priority to be shifted to the top bits when others don't. This is nearly always the problem with interrupts on Cortex M3 parts.

[ 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