Cuestion about OS_EnterInterrupt() and OS_EnterNestableInterrupt() ...

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Cuestion about OS_EnterInterrupt() and OS_EnterNestableInterrupt() ...

    Hi. I'm working on a project which makes use of "embOS for M32C and Renesas NC308 compiler" and I've found a bug in my firmware I should solve. The device that I'm programming is an RS-232/RS-485 comunications concentrator, and the problem ocurs when there is high communications throughput. In this situation, some times, the concentrator looses some bytes in one of it's UARTs, and this slows down the communications process due to communication retries.

    I have carefully checked the firmware and have realized that the problem is due to the fact that these "lost bytes" are not received in the interrupt routine, maybe because the processor is busy executing another interrupt. So maybe the problem is that some UART interrupts are lost when the system is busy on other interrupt.

    I've cheked our OS docuemntation and have found that exists a function named OS_EnterNestableINterrupt() which I'think could solve the problem reenabling the interruptions while another interrupt is being executed. The ISR function is:

    Source Code

    1. void OS_ISR_Recepcion_VIA_2 (void){
    2. unsigned char Data;
    3. OS_EnterInterrupt();
    4. Data = (unsigned char) U2RB;
    5. OS_PutMailCond1(&Cola_Recepcion_VIA_2, &Data);
    6. OS_LeaveInterrupt();
    7. }

    My cuestion is: would be right replace OS_EnterInterrupt(); with OS_EnterNEstableInterrupt?

    Thanks in advance!

  • Hello Jordi,

    you can use OS_EnterNestableInterrupt()/OS_LeaveNestableInterrupt() to have nestable interrupts which means that an interrupt routine can be interrupted by another interrupt routine. But I can't know if this solves your problem, if your cpu is to busy this will not help. You should check which parts and interrupt routines of your application needs how much cpu time and decide then which interrupt routine gets a higher interrupt priority.