Quality RTOS & Embedded Software

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




Loading

Queing a Message From Within a Queue Handler (not functioning)

Posted by groger57 on July 18, 2016

Hi,

I have a touch screen handler application. I want 2 queues to handle both incoming messages for screen touches, and a queue handler for outgoing messages back to the screen.

Separately, they both function with no problem. The queue for updating the screen can take messages using xQueueSendToBack, and it updates the screen OK. The queue for receiving messages works OK and receives messages from the screen. Right now, it just enumerates the message from the screen using the receive value. It's set up like this:

void QueueProcessScreenCmds( void *pvParameters ) { static uint8t rxValue = 0; BaseTypet xStatus;

QueueHandle_t xQueue = (QueueHandle_t) pvParameters;

  for(;;)
  { 
    xStatus = xQueueReceive( screenProcessQueue, &rxValue, rxQueue_RATE );                

    if( xStatus == pdPASS )
    {
        if( rxValue == THIS )
        {
        //do something with this
        }
    }
}

The problem is this - if I want to use the queue to "send" an update to the screen, it breaks. For example, if I want to send something to the queue in the "if rxValue == " condition, like this: xQueueSendToBack(xQueue, PR2, portMAX_DELAY );

It does not work. However, I can use that same call from a "regular" task I have created and it will function OK there. What would be the reason I cannot send to the other queue from that task function? Or is there just a better way to do this?

Thanks, Gary


Queing a Message From Within a Queue Handler (not functioning)

Posted by groger57 on July 19, 2016

Hi ! Can anyone give me some help on this, or is there another website I can post this kind of a question if it's not "appropriate" here?


Queing a Message From Within a Queue Handler (not functioning)

Posted by rtel on July 19, 2016

It does not work

First, you really need to be more specific, as everybody reading this is left guessing what "does not work" means. It could mean:

  • The queue send function returns without posting to the queue.
  • The queue send function never returns.
  • There is a hard fault.
  • There is some other kind of crash.
  • The tick interrupt stops.
  • The task stops running, but other tasks still run.
  • You get stuck in a loop somewhere.
  • etc.

Second, possible answers will no doubt be dependent on the architecture you are using: http://www.freertos.org/FAQ-how-to-use-the-FreeRTOS-support-forum.html

So for now, all that can be done is to provide a generic answer, like - do you have stack overflow detection turned on, do you have configASSERT() defined, etc. Links to such items being available from the following page: http://www.freertos.org/FAQHelp.html


Queing a Message From Within a Queue Handler (not functioning)

Posted by groger57 on July 19, 2016

Thanks....got it. An example of sending to "Queue B" while executing in "Queue A" would be nice to find, which is essentially what I am trying to do. Should be easy enough, but... I'll try setting up configASSERT with disbled interrupts macro and see where it breaks. Using that macro, is the only way to get it to stop on the configASSERT by putting a breakpoint there?


Queing a Message From Within a Queue Handler (not functioning)

Posted by edwards3 on July 19, 2016

An example of sending to "Queue B" while executing in "Queue A" would be nice to find

I dont understand your question. You can not execute in a queue, you execute in a task. Tasks can use any number of queues.


Queing a Message From Within a Queue Handler (not functioning)

Posted by groger57 on July 19, 2016

Thank you for taking the time to help me out.

A bit of silliness on my part indeed. After looking at the code it was doomed to failure from the first byte. (choke at first byte...) I gave further thought to the process and it makes more sense to have a single task that runs every "x" milliseconds and checks for incoming messages at the UART. From there, it will dispatch the message to a processing queue for screen updates - in the order it was received as I'm using a single queue item. From there I could send to multiple queues if necessary.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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