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.

LAUNCHXL-CC1352R1: Message queue not working.

Part Number: LAUNCHXL-CC1352R1


Hi,

I'm trying to communicate between tasks using tirtos7. I've followed this tutorial : https://dev.ti.com/tirex/explore/node?node=A__ATOcjUy6zyynCMWH-Ys6Ng__com.ti.SIMPLELINK_ACADEMY_CC13XX_CC26XX_SDK__AfkT0vQ__LATEST&search=queues

I can compile and flash without any problem but when i it get to mq_receive or mq_send nothing happens. If i stop the program I see that it is stuck in  Error_raiseX() especially in this error : 

if (Error_policy_D == Error_SPIN) {
for(;;) {
}
}

Do you have any clue where I could be wrong ?

Message queue init :

    mqAttrs.mq_maxmsg = MSG_NUM;
    mqAttrs.mq_msgsize = MSG_SIZE;
    mqAttrs.mq_flags = 0;
    mqdes = mq_open ("alarm", O_RDWR | O_CREAT,
            0664, &mqAttrs);
    if (mqdes == (mqd_t)-1) {
        /* mq_open() failed */
        while (1);
    }

    /* Construct writer/reader Task threads */
    Task_Params_init(&taskParams);
    taskParams.stackSize = TASKSTACKSIZE;
    taskParams.stack     = &task1Stack;
    taskParams.priority  = 2;
    Task_construct(&task1Struct, (Task_FuncPtr)mainTask, &taskParams, (void *)&mqdes);
    taskParams.stack     = &task2Stack;
    taskParams.priority  = 1;
    Task_construct(&task2Struct, (Task_FuncPtr)task1Fxn, &taskParams, (void *)&mqdes);

MainTask:

mqd_t* mqdes = arg0;
int msg = 5;

mq_send(*mqdes , (char *)&msg, sizeof(msg), 0);

task1Fxn:

mqd_t      *mqdes = arg0;
int msg;

while (1)
{
    while (mq_receive(*mqdes, (char *)&msg, sizeof(msg), NULL) != -1) {
       GPIO_toggle(CONFIG_GPIO_LED_0);
    }
}