cancel
Showing results for 
Search instead for 
Did you mean: 

CMSIS-RTOS - osMessagePut/Get Unstable...

HPham.1590
Senior

Hello, I'm testing RTOS Message queue on STM32F7,

When I try to create an message queue to send an message from Thread 1 to another thread, my data I receive in target Thread is unstable.

For example, I'm trying to send uint16_t 317, but in target Thread sometime is 0, and sometime exactly 317.

Anyone can tell me what happened?

Below is my function

// Define handle
QueueHandle_t MsgHandle;
// Define new queue 
osMessageQDef(myQueue02, 16, uint16_t);
MsgHandle = osMessageCreate(osMessageQ(myQueue02), NULL);
// Put a message
uint8_t *data = "abcxyz";
uint16_t FlashDataSize;
FlashDataSize = (int)strlen(data);
osMessagePut(MsgHandle, FlashDataSize, 0);
// Get a message
osEvent size_event;
size_event = osMessageGet(MsgHandle, 0);
// => size_event.value.v = ?? unstable (= 0 or  = 317 (correct))

Many thanks,

Hieu

0 REPLIES 0