Quality RTOS & Embedded Software

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


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


Careers

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

Renesas

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