- This topic has 0 replies, 1 voice, and was last updated 7 years, 5 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Home › Forums › Mastering STM32 book support forum › osMessageGet function
Tagged: CMSIS-RTOS, osMessageGet, stm32
Hello all,
I have been working on a software based on CMSIS-RTOS and I have a problem with
function osMessageGet. My software consists of four RTOS tasks and two of them
exchange data via osMessageQueue in conjunction with osPool. One task (Task_100ms)
is a producer and second task (Task_200ms) is a consumer.
Task_100ms receives data from CAN bus and creates structures containing the received
data. The producer allocates memory on pool (flash_pool) using function osPoolAlloc
and receives pointer to allocated memory. Producer copies the content of exchanged
structure onto the memory block in pool using this pointer and puts copy of this
pointer onto the queue (flash_queue) using function osMessagePut.
Task_200ms tries to retrieve the pointers from flash_queue using osMessageGet function.
As long as the queue is empty consumer waits and everything is OK. Then a first pointer
is put onto flash_queue by Task_100ms. Task_200ms calls osMessageGet function and
this results in uC reset in case the timeout for osMessageGet is set to osWaitForever.
In case the timeout for osMessageGet is set to 0 software reset isn’t invoked.
But in both cases (timeout equal 0 or osWaitForever) when I step through the code
in Eclipse I am not able to achieve the immediately following statement after
osMessageGet function call.
Can anybody give me any advice where a cause of my problems could be? I can send
you whole source code if it is needed. Thanks in advance for any suggestions.