Hello everyone!
Well, the topic is what I want, here are the reasons why I want to know this:
In my actual project I get dropped somehow in the RTX Error function osError. I've checked the registers, searched for the Thread who caused the error and double checked my MessageQueues and MemoryPools. But the Thread ID I get is none of my user Threads and the register values are not very useful.
So I've started to read why a mailbox overflow could happen. Mostly there is not enought memory in the message queue to put a new message into, and for some reasons the message is placed in the queue anyway and the mailbox overflow error is set.
Till now, I couldn't find any of these special reasons, why the messages were placed into the queue...
Here is some code example where I place messages in the Queue (using a function):
bool Place_DataStruct_in_Queue(Data_Struct theData) { // local variables Data_Struct * pData = 0; osStatus Status = osOK; // get a new memory block from pool pData = (Data_Struct *)osPoolCAlloc(MemPool_Data); // check pointer value (0 in case of no memory) if(pData) { // memory reserved, fill data pData->a = theData.a; pData->b = theData.b; pData->c = theData.c; // send into queue Status = osMessagePut(MsgQueue_Data, (uint32_t)pData, 0); // check status if(Status != osOK) { // can't add message, free reserved memory from pool osPoolFree(MemPool_Data, pData); return False; } else { // message successful added return True; } } else { // no more memory in pool return False; } }
I'm not sure if the problem is somewhere deeper, but both, memory allocating and message put functions should be threadsafe right?
I want to find out, what I have to make in the pool or queue to trigger this mailbox overflow error. Is there some special function?
Thanks
Alain