Help with TaskQ

Help with TaskQ

Home Forums Example Projects Help with TaskQ

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Farukh Chaudhry 1 day, 21 hours ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #25943

    Ravi Suppiah
    Participant

    Hi

    I have used uCOS2 before on a Robotic Platform and am trying out the Windows version on Visual Studio 7.
    I have written a simple code with 2 tasks with that communicate with each other using Task Queues.
    The first Task (A) sends out the data and goes to a blocked state waiting for a reply.
    The other task (B) doesnt seem to received the message. There are no errors in the code but I can
    seem to figure out what went wrong.

    The sender task is

    OSTaskQPost((OS_TCB *)&TaskBTCB,
    (CPU_INT08U *)count,
    (OS_MSG_SIZE)sizeof(CPU_INT08U),
    (OS_OPT)OS_OPT_POST_FIFO,
    (OS_ERR *)&os_err);

    rx_val = (CPU_INT08U)OSTaskQPend((OS_TICK)0,
    (OS_OPT)OS_OPT_PEND_BLOCKING,
    (OS_MSG_SIZE *)&size,
    (CPU_TS *)&ts,
    (OS_ERR *)&os_err);

    the receiver task is

    while (DEF_TRUE) {
    printf(“\nTask B”);

    msg_data = (CPU_INT08U)OSTaskQPend((OS_TICK)0,
    (OS_OPT)OS_OPT_PEND_BLOCKING,
    (OS_MSG_SIZE *)&size,
    (CPU_TS *)&ts,
    (OS_ERR *)&os_err);

    printf(“Message Received in Task B: %d”, msg_data);

    msg_data++;

    OSTaskQPost((OS_TCB *)&TaskATCB,
    (void *)msg_data,
    (OS_MSG_SIZE)sizeof(msg_data),
    (OS_OPT)OS_OPT_POST_FIFO,
    (OS_ERR *)&os_err);

    }

    I know I enter Task B from the first printf statement.
    But subsequently, I seem to be stuck in the TaskQPend() without receiving the message.

    What could be wrong?

    Any help will be much appreciated!
    Thanks!

    #25986

    Farukh Chaudhry
    Participant

    Hello,

    Make sure the task queue buffer size is specified when creating the tasks. Can you post the task create code?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

View the complete site map

x
Loading...