Defining a queue in a task (ie local) behaves as expected*, but when the queue is defined globally then initialised in main (and checked the return code for success) the task is oblivious ie a length check has an erroneous return value and queue operations fail resulting in multitasking failure.
*like GenQTest.c operation to check a queues functionality with send and receive in the same task (but this has a passed in queue)
Download Community Contributed port using LM19 temperature sensor and got a three task flashing LED working on my newish MPLAB V3.25 and noticed FreeRTOS was V5.4.2
Read about queues and tried a test and resulted in multitasking failure as another task just flashing a led with a delay, failed.
Pared back to get something to work which is defining the queue handle in a task, creating the queue, checking the return code, then sending and receiving and length check all function.
defining globally, creating and checking in main and using in task….fails
- debug stops at “for( pxIterator = ( xListItem * ) &( pxList->xListEnd );…”
-FAQ9.1"stack"=checked, FAQ9.2"priority"=inherited working? tried variations, FAQ9.3"API"=not relevant
- not caught in the enabled stackoverflow trap, that works when the stack is reduced
- not affected by doubling the stack till stack allocation fails and falls into the post scheduler trap
- no success with changing configUSE_PREEMPTION, INCLUDE_*,HEAP,configTICK….
- tried defining a global byte variable alongside, initialised alongside in main and was usable in the task, so confirming something can be used globally
- tried removing the global definition and it gives the expected compilation warnings so demonstrating the global definition is correctly typed for that instance of use
- tried passing in the queue handle (as per GenQTest.c)
- tried Googling …and a few choice words
I guess my next step is a rewrite from scratch with the latest version! as it maybe a version issue but it may not and I could be in the same situation, unless there is a nugget of information from someone who has thankfully read this far!
Thanks for your interest