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

Is there a way I can use xQueueSelectFromSet in tandem with xQueueReceive?

Posted by kailashs on February 19, 2016

Hi,

I am using FreeRTOS v8.2.3 on a PIC32 micro controller. I have a case where I need to post the following 3 events to 3 corresponding queues from an ISR, in order to unblock a task awaiting one of these events at a time - a) SETUP packet arrival b) Transfer completed event 1 c) Transfer completed event 2

My exection sequence and requirement are as follows:

Case 1 (execution is blocked for an event at point_1): As SETUP arrives while waiting at point_1 of execution - i) the waiting task should be unblocked ii)Setup received from queue and processed

Some code is processed and reaches point_2

**Case 2 (execution is blocked for an event at point2): ** If any one of SETUP or transfer complete events occur at point2 - i) unblock the wait ii) receive transfercomplete1 or transfercomplete2 event from queue to carry out some additional transfers and loop at point2 iii)if it was a Setup queue event, do not receive, but go to point1

The code does not seem to work when I try to use xQueueReceive and xQueueSelectFromSet on the Setup queue even when one of them is used at point1 and the other used at point2. But seems to work fine if I use xQueueSelectFromSet at both the places and verify the queuset member handle that caused the event to proceed further.

Given the requirement above, the problem with using xQueueSelectFromSet at both the places is that - the xQueueSelectFromSet call will be placed back to back, first on a Setup event at point2 and then immediately on point1 which is not intentional - the xQueueSelectFromSet call at point_1 is also not desired

Hence can anyone please explain whether and how to use both a queueset and queuereceive on the same queue? If not possible how do we typically implement the above requirement in FreeRTOS?

Thank you very much for your precious time in advance. Have a good day!!!

  • Kailash -

Is there a way I can use xQueueSelectFromSet in tandem with xQueueReceive?

Posted by rtel on February 19, 2016

I don't fully understand your usage scenario, but some points which may help.

1) If a queue is a member of a queue set, then the queue can only be read after its handle has been returned from the queue set. Further, if a queue's handle is returned from a queue set then the item must be read from the queue. If either of these requirements are not met then the state of the queue set will not match that of the queues in the set.

2) If the same task is reading from the multiple queues then it is probably not necessary to use a queue set at all. See the "alternatives to using queue sets" section on the following page: http://www.freertos.org/Pend-on-multiple-rtos-objects.html


Is there a way I can use xQueueSelectFromSet in tandem with xQueueReceive?

Posted by kailashs on February 20, 2016

Thanks, for the pointers. I guess may need a revisit on the queueset alternative with respect to my use cases. BTW, my usage scenario is an implementation of a USB device driver which receives / sends USB packets (through a SIE) over the bus from / to a host computer, thus enabling the device enumeration along with implementing the business logic framework for application layers who are providers / consumers of data.


[ 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