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:
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?
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:
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: FreeRTOS - Open Source RTOS Kernel for small embedded systems
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?
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.