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.

Calling Semaphore_pend inside a function causing stack overflow

If I call Semaphore_pend directly inside task function, there is no problem.

Such as:

void q_comm_task()
{
    _q_rxque_reset();
    Hwi_enableInterrupt(96);

    while(1)
    {
        Semaphore_pend(q_rcv_available_semqphore, 50);
    }

}

But if I move Semaphore_pend into a function, it will cause stack overflow in this task about 5 seconds after the task run.

void qmix_comm_task()
{
    _qmix_rxque_reset();
    Hwi_enableInterrupt(96);

    while(1)
    {
        _q_slave_proc();

    }
}

void _qmix_slave_proc()
{
    Semaphore_pend(qmix_rcv_available_semqphore, 50);
    return;
}

And weird thing is, the time to stack overflow is related with the timeout value I put into the Semaphore_pend call. If I put 100, it will go stack overflow after about 10 seconds. It will not cause stack overflow at first time calling Semaphore_pend, but several times later. Anybody help?