Nestable Interrupt

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

  • Nestable Interrupt

    Hi,
    I work on EmbOS for M32C, version 3.08, IAR Compiler V3.30.
    I'm using four UARTs on my application to communicate with others firmware. The communication on one UART is full duplex, the firmware can send spontaneous message to my application. I'm experiencing some overrun of data on that UART. It's seems to be due to the fact that my application is sending data while the firmware is also sending data. I think that the reason of the loss of data in reception could be due to the fact that the Emission Interrupt is not nested by the Reception interrupt. I've put in place the OS_EnterNestableInterrupt() without any optimization. I've checked in the documentation to have more information about interrupt, but the documentation is very poor on this subject.
    Coudl it be possible to have any clue or documentation to help me in the resolution.
    Cheers.
  • Hello Vincent,

    sorry for late reply.
    Yes, this will work, you could check in an interrupt routine if interrupts are reenabled (I flag in program status word).

    Your interrupt routine should look like:

    C Source Code

    1. #pragma INTERRUPT OS_ISR_rx
    2. void OS_ISR_rx (void) {
    3. OS_EnterNestableInterrupt(); // We will enable interrupts
    4. ... // Set here a breakpoint and check if interrupts are reenabled
    5. OS_LeaveNestableInterrupt();
    6. }



    Regards,
    Til
  • Ok, the I flag is right so it seems to work.

    I experience some freeze of my software. It seems to be due to OS which is locked in "OS_Send1" function because OS_TxActive variable is never equal to zero. What is strange is that I'm not using the feedback for EmbOSView.

    Are you aware of a bug in v3.08 for the the function OS_Send1 in relation with OS_TxActive ? Do you a way of resolution of this issue?

    Regards.
    Vincent
  • Hi,
    I have two configuration for my IAR project. One is Debug configuration where the output to EmbOSView is activated on OS_UART=1 and one is a Release configuration where the EMbOSView is deactivated OS_UART=-1. When I have a look on rtosinit.c, I have the following code:


    #else /* No communication routines */
    void OS_COM_Init(void) {}
    void OS_COM_Send1(OS_U8 c) {
    OS_COM_ClearTxActive(); /* let OS know that transmitter is not busy */
    }
    void OS_Sendstring(void) {
    }
    #endif /* (OS_UART==0) || (OS_UART==1) */

    I think that the function OS_Sendstring(void) in bold in the sample of program is not correctly defined. By that, when OS_UART=-1, the function OS_SendString and OS_Send1 are called in my application and I have case where OS_TxActive is not reset to zero and block the application in an infinite loop in the following function:



    [Part of post deleted by Segger]



    Do you have a feedback on that issue? and a workaround for me?

    Regards.
    Vincent
  • Hello Vincent,

    I think that the function OS_Sendstring(void) in bold in the sample of program is not correctly defined. By that, when OS_UART=-1, the function OS_SendString and OS_Send1 are called in my application and I have case where OS_TxActive is not reset to zero and block the application in an infinite loop


    If you have set OS_UART=-1 OS_SendString() is an empty function which wil never set OS_TxActive = 1.
    Please don't post any of our generic sources here. I deleted that part from your post.

    I will contact you by email, I guess it's easier to solve this issue by mail.
    Does not sound like a major problem.

    Best regards,
    Til
  • I'm always experiencing issue using interrupt. I'm on EmbOS, version 3.08 for M32C. I assume this a old version of EmbOS, but I can't do the update to the last version for the moment because I have to evaluate the impact and no time for that.


    In my application, I have 6 Rs232 and 1 CAN bus, each have an interrupt handler.


    I have a loss of data on Rs232, and I suspect the fact that interrupt are not nestable. The character lost are on Rs232 with the highest IT priority.


    When I have a look on function OS_EnterNestableInterrupt(), I see a call to OS_EI() which enable the interrupt. I've a test which confirm that the I flag is set. But when I have a look to OS_LeaveNestableInterruptNoSwitch(), I see a call to OS_DI() without any call to OS_EI() after that. So, my conclusion is that the interrupt are all disable after a call to
    OS_LeaveNestableInterruptNoSwitch().


    Could you please confirm me this remark ? Is it a bug of EmbOS v3.08 ? Is there a modification I can implement to solve this issue ?