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




Loading

Cannot use same queue to get data when queue used in a queue set

Posted by embgangsta on April 15, 2014

Hi,

I have created a queue set QS1 which has queues QC1 and QD1 as queue members.

My task T is waiting on this QS1 and then process data received in QC1.

Upon this processing, my task needs to wait (my design need to do it this way) directly on QD1 to receive data with a xQueueReceive to get data sent within some UART interrupt.

For information I am using FreeRTOS v7.5.2 on EFM32LG280 chip.

I see that my task is only unblocked after a quite long time whereas data was alread posted soon after xQueueReceive was really executed (seen instrumenting code + tracing data).

It seems that if I remove the QD1 from the queue set QS1, then the data receive is working fine as soon as the first interrupt put data in this QD1 ...

So it seems a task cannot use a same queue directly with xQueueReceive when this queue belongs to a queue set ...

Is it an expected result ??

Thanks


Cannot use same queue to get data when queue used in a queue set

Posted by rtel on April 15, 2014

If I understand your question correctly, then yes I think this is the expected results.

If data is sent to a queue that is a member of a queue set then a task that was blocked on the set to which the queue belongs will be unblocked, while a task that was blocked directly on the queue itself will not be unblocked.

You could remove the queue from the set first (if there is a function to do that?), then block on the queue. Doing that would risk the queue set telling you there was something in the queue when there wasn't (because it had already been removed) but that would not necessarily be a problem provided when you read from a queue handle returned from the set you don't block and check the return value of the xQueueReceive() call to check you actually got data before you try and process it.

Regards.


Cannot use same queue to get data when queue used in a queue set

Posted by embgangsta on April 15, 2014

Only one task MY_TASK here is using the queue set QS1 and data queues QC1 / QD1.

If I sum up what my task MY_TASK is doing :

At time T0=0, waiting on QS1 At time T0+deltaT, unblocked on QS1 as QC1 was populated with data Now the task MY_TASK is doing processing in which we are doing a xQueueReceive on QD1 and no more on the initial queue set.

At this moment I can see my problem appearing.

Is it what you understood ?


Cannot use same queue to get data when queue used in a queue set

Posted by rtel on April 15, 2014

Yes. QD1 is part of the set, so if you block on QD1 you will not unblock when data arrives (in effect, the unblock event is going to the set, not the queue).

Regards.


Cannot use same queue to get data when queue used in a queue set

Posted by embgangsta on April 15, 2014

Oh ok, so FreeRT is no longer unblocking the QD1 itself, only the QS1 ??

So I really have to remove the QD1 member from QS1 before to use QD1 directly ... ? and then add it again ....


Cannot use same queue to get data when queue used in a queue set

Posted by edwards3 on April 15, 2014

If your application allows you to get away with it you could simply poll the queue without blocking, maybe with a short delay if the queue is empty:

while(xQueueReady( queue, &var, 0 /* 0 so dont block */ )==0){ vTaskDelay( afewms ); }

you would probably want a manual time out to make sure you dont sit there forever.


Cannot use same queue to get data when queue used in a queue set

Posted by embgangsta on April 16, 2014

Hi,

I finally updated my task architecture to introduce the different acquisition modes altogether so I am only using one same mechanism (queue set)

Thanks anyway for support


[ 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