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.

RTOS/CC1310: Setting up multiple mailboxes on CC1310

Part Number: CC1310
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

I am trying to get 3 mailboxes set up on my CC1310. I've tried to use the mailbox example driver, but when I go to create the handle, I get the compile error:

#256 type name is now allowed

This is my main where I initialize the Mailboxes:

int main(void)
{
    /* Call driver init functions. */
    Board_initGeneral();

    /* Open LED pins */
    ledPinHandle = PIN_open(&ledPinState, pinTable);
    Assert_isTrue(ledPinHandle != NULL, NULL);

    /* Parameters for mailbox */
    Mailbox_Params mb_params;

    Mailbox_Params_init(&mb_params);
    mb_params.buf = (Ptr)DINmailboxBuffer;
    mb_params.bufSize = sizeof(DINmailboxBuffer);
    Mailbox_construct(&din_mb_struct, sizeof(MsgObj), DIN_NUMMSGS, &mb_params, NULL);
    din_mb = ti_sysbios_knl_Mailbox_Handle(&din_mb_struct);

    Mailbox_Params_init(&mb_params);
    mb_params.buf = (Ptr)DOUTmailboxBuffer;
    mb_params.bufSize = sizeof(DOUTmailboxBuffer);
    Mailbox_construct(&dout_mb_struct, sizeof(MsgObj), DIN_NUMMSGS, &mb_params, NULL);
    dout_mb = ti_sysbios_knl_Mailbox_Handle(&dout_mb_struct);

    Mailbox_Params_init(&mb_params);
    mb_params.buf = (Ptr)DACKmailboxBuffer;
    mb_params.bufSize = sizeof(DACKmailboxBuffer);
    Mailbox_construct(&dack_mb_struct, sizeof(MsgObj), DIN_NUMMSGS, &mb_params, NULL);
    dack_mb = ti_sysbios_knl_Mailbox_Handle(&dack_mb_struct);

    /* Semaphores */
    Semaphore_Params semParams;
    Semaphore_Params_init(&semParams);
    Semaphore_construct(&semXmitStruct, 0, &semParams);
    /* Obtain instance handle */
    semXmitHandle = Semaphore_handle(&semXmitStruct);

    /* Initialize task */
    RxTask_init(ledPinHandle);
    TxTask_init(ledPinHandle);

    /* Start BIOS */
    BIOS_start();

    return (0);
}

What do I need to do to get these mailboxes set up properly?

  • Hi Ryan,

    There are two things you can try.

    Replace

    din_mb = ti_sysbios_knl_Mailbox_Handle(&din_mb_struct);

    with

    din_mb = ti_sysbios_knl_Mailbox_handle(&din_mb_struct);

    OR

    din_mb = Mailbox_handle(&din_mb_struct);

    Do this for all your mailboxes, and your code should compile without that error.

    Regards, 

    Toby

    
    

  • making the H in handle lower-case worked, thanks!

    Followup question; I see in the example that the MsgObj struct created has an ID and a val property. Am I required to pass in a value for ID when posting to the mailbox, or will one be assigned automatically? Also, how do I set up the val property of the struct to accept more than 1 character? At the moment, the struct looks like this:

    typedef struct MsgObj {
        Int     id;
        Char    val;
    } MsgObj;

  • The MsgObj is customizable.

    For example:

    #define VAL_LENGTH (10)

    typedef struct MsgObj {

         int id;

         char val[VAL_LENGTH];

    } MsgObj;

    Now the val will take up to VAL_LENGTH characters.

    In general, you don't want to rely on default values. In the mailbox example, writerTask initializes id with msg.id = i;