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.

sys/bios mailbox issue on 6678

When I create two instances of sys/bios mailbox object, and try to post one of them, the other one gets signaled. I have the same issue, whether I create objects via C code or via cfg editor.

Furthermore,HMailBox1 and HMailBox2 pointers are different when I watched em. If I am doing something wrong, then what should I do to make two mailbox objects not interrupt each others. Below is the code that causes the issue:

(bios version 6_41_00_26)

 
#include <xdc/std.h>

#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Mailbox.h>
ti_sysbios_knl_Mailbox_Handle HMailBox1;
ti_sysbios_knl_Mailbox_Handle HMailBox2;

/*
 *  ======== taskFxn ========
 */
Void taskFxn1(UArg a0, UArg a1)
{
    while(1)
    {
        //Task_sleep(1000);

        unsigned char message;

        // this one gets signaled when HMailBox2 is post!!!
        int success = Mailbox_pend(HMailBox1, &message, BIOS_WAIT_FOREVER);
    }

}


Void taskFxn2(UArg a0, UArg a1)
{

    int semId =4;
    while(1)
    {
        Task_sleep(1000);
        Mailbox_post(HMailBox2, &semId, 0);

         System_printf("taskFxn2()\n");
         System_flush(); /* force SysMin output to console */
    }

}


/*
 *  ======== main ========
 */
Int main()
{ 
    Task_Handle hTask1, hTask2;
    Error_Block eb;

    System_printf("enter main()\n");

    Error_init(&eb);
    hTask1 = Task_create(taskFxn1, NULL, &eb);
    if (hTask1 == NULL) {
        System_printf("Task_create1() failed!\n");
        BIOS_exit(0);
    }

    hTask2 = Task_create(taskFxn2, NULL, &eb);
    if (hTask2 == NULL) {
        System_printf("Task_create2() failed!\n");
        BIOS_exit(0);
    }

    Mailbox_Params pr1, pr2;
    Mailbox_Params_init(&pr1);
    Mailbox_Params_init(&pr2);

    pr1.__iprms.name = "osman";
    HMailBox1 = Mailbox_create(1, 8, &pr1, &eb);
    pr2.__iprms.name = "mahmut";
    HMailBox2 = Mailbox_create(1, 8, &pr2, &eb);

    BIOS_start();    /* does not return */
    return(0);
}

thanks
  • Hi,

    Why do you think the HMailBox1 is getting posted? I just ran your code and it was never posted (granted it was on a newer BIOS, but that code has not changed for a long time).

    Also, you should be checking the return code from the Mailbox_post(HMailBox2, &semId, 0). It works the first 8 times (the number of messages you have in the mailbox) and then fails since no one is pulling them out and you have a timeout of zero. If you used BIOS_WAIT_FOREVER on the post, it would have blocked on the 9th pend. What you are doing is not a problem as long as you realize what it is doing.

    Additionally, you can re-use pr1 instead of having both pr1 and pr2 in main. This will reduce the size of the application and speed up the boot time slightly.

    Also, which is device is this for?

    Todd
  • Hi Todd,

    I know Mailbox_post() will not work after 8  times but this not the issue. The problem occurs even after the first pots of the Hmailbox2 object.

    I am working on evm6678.

    I am on my holiday right now, I will try to figure out what really happens as soon as I am back.,and let you know.

    thanks ..