This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RTX51-full - os_wait for ever

Hello all.
Can anyone help me with the following one?
My target is working under RTX51-full. I have an interrupt function (void mc12comm() interrupt 0 using 3) that calls other regular function, and this regular function creates a task. The task is enveloped with an endless loop (while 1) and at the end of the loop there's: os_wait(K_TMO, _2_SEC, 0);
I have about 5 tasks in the code and all of them works fine but in this task the program execute the os_wait function forever and not for 2 seconds as required.
Is it because the interrupt function calls regular function that creates a task?

Please help,
Reuven

Parents
  • Thanks a lot Toni for your advices but nothing help.
    I will try to explaine againe my problem with a code sample:
    The init task creates TASK1 and enables interrupt 0. Interrupt 0 send a signal to TASK1. TASK1 waits for signal from interrupt function and when received it he clear the signal and creates other task - TASK2. TASK2 suppose to blink a LED. The problem is that when the program gets to the first wait statement he waits there forever!

    The question is WAY???

    For better understanding my current code looks something like that:

    void init() _task_ INIT
    {
    os_create_task(TASK1);
    os_enable_isr(0);
    }

    void int0() interrupt 0 using 3
    {
    os_send_signal(TASK1);
    }

    void task1() _task_ TASK1
    {
    while(1) {
    os_wait(K_SIG,255,0);
    os_clear_signal(TASK1);
    os_create_task(TASK2);
    }
    }

    void task2() _task_ TASK2
    {
    leds = on;
    os_wait(K_TMO, _2_SEC, 0);
    leds = off;
    os_wait(K_TMO, _2_SEC, 0);
    }

    P.S. I tried also:
    void task1() _task_ TASK1
    {
    If (os_attach_interrupt(0))
    os_delete_task(os_running_task_id());
    while (1) {
    os_wait(K_INT,0xFF,NULL);
    :
    }
    }
    but it also NOT helping me. The program, for some reason, doesn't attach the task to the interrupt and the task delete.

    PLEASE HELP :-((

Reply
  • Thanks a lot Toni for your advices but nothing help.
    I will try to explaine againe my problem with a code sample:
    The init task creates TASK1 and enables interrupt 0. Interrupt 0 send a signal to TASK1. TASK1 waits for signal from interrupt function and when received it he clear the signal and creates other task - TASK2. TASK2 suppose to blink a LED. The problem is that when the program gets to the first wait statement he waits there forever!

    The question is WAY???

    For better understanding my current code looks something like that:

    void init() _task_ INIT
    {
    os_create_task(TASK1);
    os_enable_isr(0);
    }

    void int0() interrupt 0 using 3
    {
    os_send_signal(TASK1);
    }

    void task1() _task_ TASK1
    {
    while(1) {
    os_wait(K_SIG,255,0);
    os_clear_signal(TASK1);
    os_create_task(TASK2);
    }
    }

    void task2() _task_ TASK2
    {
    leds = on;
    os_wait(K_TMO, _2_SEC, 0);
    leds = off;
    os_wait(K_TMO, _2_SEC, 0);
    }

    P.S. I tried also:
    void task1() _task_ TASK1
    {
    If (os_attach_interrupt(0))
    os_delete_task(os_running_task_id());
    while (1) {
    os_wait(K_INT,0xFF,NULL);
    :
    }
    }
    but it also NOT helping me. The program, for some reason, doesn't attach the task to the interrupt and the task delete.

    PLEASE HELP :-((

Children