This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

The BUG of MAILBOX IN RTX

The following code is part of RL-CAN in RL-RAM

static CAN_ERROR CAN_pull (U32 ctrl, CAN_msg *msg, U16 timeout)
{ CAN_msg *ptrmsg = NULL; U32 ctrl0 = ctrl-1; /* Controller index 0 .. x-1 */ OS_RESULT result; /* Wait for received message in mailbox */ result = os_mbx_wait (MBX_rx_ctrl[ctrl0], (void **)&ptrmsg, timeout) ; if (result == OS_R_TMO) return CAN_TIMEOUT_ERROR;

/* Copy received message from mailbox to address given in function parameter msg */ if(ptrmsg) *msg = *ptrmsg; else return CAN_TIMEOUT_ERROR;

/* Free box where message was kept */ if (_free_box (CAN_mpool, ptrmsg) == 1) return CAN_DEALLOC_MEM_ERROR;

return CAN_OK;
}

I made some change to the code . but just a little.

the value of os_mbx_wait function returned should be OS_R_MBX or OS_R_TMO or OS_R_OK, but sometimes the result value is a address , maybe the MBX_rx_ctrl's value. That happened not very frequently, but it happened.

I don't know why?