I apologize in advance if this question has been posted. If so, could you please post a link as I searched and could not find what I am looking for.
Very basic: I’ve set a up a message queue with 3 elements of uint8. I’ve declared the queue handle and the “pvItemToQueue” globally so I could call it from another module/function. In that function I use “extern” to declare the 2 variables.
When I send to the message queue from withing the module where it’s defined (in main.c) the rx queue seems to function OK. When I try to send a message from the other module (& function) the message never seems to show up in the rx queue.
One thing to note: the function where the queue is (seemingly) not working is called in a Timer ISR. Not sure if this has any significance - I realize that there’s a different call for ISR’s. I changed the call to the ISR queue send, but it did not appear to work either.
Please post a snippet of code that shows how the queue handle is
declared and used in the separate module (the one that is not working).
Please also say which port you are using (makes a difference as to how
helpful configASSERT() would be in finding the problem).
I also perform a send to queue in the main function where the queue is declared and the function handler is. There is no issue sending to the queue from main.
However, from the other module/function, when I try to send to queue from there (as shown in the above post) it actually seems to inhibit (block?) the send to queue in main from functioning. When I comment out the xQueueSend (in the last post) the call to xQueueSend in main can be seen by the response in the handler.
I’m still trying to understand how it could get by this without printing anything
There are only two paths through there. If its not printing either then it can mean one of two things, either the code is not being run or your printf function is not working.
I also perform a send to queue in the main function
Before calling vTaskStartScheduler()? Probably not a good thing to do.
You’re assuming I call xQueueSend before launching the scheduler? Why would I do that?
Let’s assume the printf works for the reason I indicated, that I have printf’s before and after to clarify oto the reader that printf does work properly. There’s no issue with printf running anywhere on this controller.
That leaves: " the code is not being run…"
Why would it not run? All header files are included…
Suggestions as to what I could try next are welcome.
You’re assuming I call xQueueSend before launching the scheduler?
Wasnt assuming, you implied it “I also perform a send to queue in the main function” main() doesnt run after the scheduler has been started, only before.
Why would it not run?
I dont know, I can only see a fragment of your code, but as you say printf() is working, and as there are no paths through the code that dont print something but nothing is printing, logic says the code is not being run. You can find out easily by putting a break point on the queue send. If the break point is hit then the code is being run, and you can step through the source in the debugger to see why the print never prints.
I was only asked to post the code that I did. I can post it all, but I don’t see how this is that complex. I create the queue, declare the function, launch the scheduler, run the send queue from the main module, and it works.
I try to run the send queue from the other module, and it not only not works there, it stops the one in the main module from running.
In the other module, I set the code to this:
xQueueSendToFront( eventQueue, &mssgEvent, rxQueue_RATE );
No printf after, just variable assignments. I put a breakpoint on one of those variable assignments. It never reaches anything after. Like it beams up, without hanging up the system.
Again, if I comment this out - in the external module function - the call xQueueSend in the function in the “main module” runs OK, the receive handler/function gets the message.