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
  • Hello Reuven,

    Yes, your assumption is right. In the context of C51 interrupt functions calls to system functions named with the prefix 'os_' are not allowed. The complete code in the interrupt function, including all called functions, run under the context of the ISR.

    One solution is to create a fast or standard task and assign the interrupt with 'os_attach_interrupt'. In the tasks code, wait for the interrupt with 'os_wait'. The rest of the code can bee the same as you described.

    If you need the fast reaction of the ISR, create the task with the two seconds wait loop at configuration time. Use 'isr_send_signal' in the ISR to start this task.

    Hope this helps,
    Toni

Reply
  • Hello Reuven,

    Yes, your assumption is right. In the context of C51 interrupt functions calls to system functions named with the prefix 'os_' are not allowed. The complete code in the interrupt function, including all called functions, run under the context of the ISR.

    One solution is to create a fast or standard task and assign the interrupt with 'os_attach_interrupt'. In the tasks code, wait for the interrupt with 'os_wait'. The rest of the code can bee the same as you described.

    If you need the fast reaction of the ISR, create the task with the two seconds wait loop at configuration time. Use 'isr_send_signal' in the ISR to start this task.

    Hope this helps,
    Toni

Children
More questions in this forum