This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OMAP L138 MBX Issue

Hello,

I'm currently running some code on the DSP that shuffles data between mailboxes in an ISR. The code uses an MBX_pend() to retrieve a message from a full mailbox. Upon successful completion of that call it then immediately attempts to put a new message into that same mailbox using MBX_pend. A timeout of 0 is used for the MBX_pend() and MBX_post() as they are being called within an ISR. What I am noticing is that the MBX_pend() succeeds, which by my understanding immediately removes a sample from the MBX, therefore, giving it an open spot. However, the following MBX_post() to that MBX always fails. Does anyone have an explanation as to what is going on and what I can do to resolve this?

Thanks,

\Greg

  • Greg,

    The Mailbox module copies the buffer to fixed-size internal buffers.
    The size and number of these buffers are specified when a Mailbox instance is created (or constructed).
    A copy is done when a buffer is sent via MBX_post().
    Another copy occurs when the buffer is retrieved via a MBX_pend().

    MBX_pend():
    If timeout is SYS_FOREVER, the task remains suspended until MBX_post is called on this mailbox.
    If timeout is 0, MBX_pend returns immediately.

    MBX_post():
    If the mailbox is full and timeout is SYS_FOREVER, the task remains suspended until MBX_pend is called on this mailbox.
    If timeout is 0, MBX_post returns immediately.

    I hope, the below wiki page may help you for debug
    http://processors.wiki.ti.com/index.php/DSP_BIOS_Debugging_Tips#Cause:_MBX_message_size_does_not_correspond_to_size_of_message_buffer

  • Hi Pubesh,

    Thank you for your response. However, I do not think this is an issue of misuse or misunderstanding of the mailbox structures.I am attempting to improve performance on some code I had previously written. The code worked before with these same exact mailboxes. The difference is that previously I was performing an MBX_pend() on this mailbox in the ISR, but the MBX_post() was performed in a separate thread with a SYS_FOREVER timeout. I am trying to improve performance by immediately filling the spot that is opened by the MBX_pend() with an MBX_post(), with a timeout of 0, in that same ISR. Am I correct in understanding that immediately after a call of MBX_pend() the mailbox will have a free space if it was previously full? Or is there some delay or special case of calling this function in an ISR or calling this function with a 0 timeout that could explain what I am seeing? That seems to be what I am observing. If I break into the ISR with a debugger the mailbox counts are as I would expect with the MBX_pend() successfully reducing the mailbox count and leaving an empty space such that the following MBX_post() will succeed. However, if I do not use a debugger, through the use of log messages I see that immediately after a successful MBX_pend() on a full mailbox, an MBX_post() will fail. Do you have any explanation as to what is going on here?


    Thanks,

    \Greg