Issue: My Task1 is sending message if(os_mbx_check() > 0)
Task 2 is waiting for message and reading the msg.(and assume it has low priority) like below:
Line 1: os_mbx_wait (client_task_mailbox, (void **)&ptrMessage, 0xFFFF); { Line 2: X = *(ptrMessage) ; Line 3: _free_box (client_task_mpool, ptrMessage); }
Assume I have 5 slots and Task1 has filled all the slots and now the mailbox is full, and task1 is waiting for at least 1 free slot. Now Task 2 gets the chance to execute. As soon as Task 2 detects there is a message and when I am at line 2, say Task1 kicks in and now it detects one free slot and sends a message and I get Hard_Fault.
This is solved by declaring ONE EXTRA in _declare_box() as shown below: os_mbx_declare (MsgBox,5); _declare_box (mpool,sizeof(Flash_Data),6);
Any better solution?
Regards, JD