Wednesday, February 21st 2018, 2:01am UTC+1

You are not logged in.

  • Login
  • Register

Vincent

Beginner

Date of registration: Dec 21st 2012

Posts: 14

1

Friday, December 21st 2012, 9:46am

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.

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 264

2

Friday, December 21st 2012, 5:56pm

Hi Vincent,

which interrupt priorities do you use for Uart RX and TX interrupt?
Please be aware that the current running interrupt can only be nested by other interrupts with a higher interrupt priority.

Best regards,
Til

Vincent

Beginner

Date of registration: Dec 21st 2012

Posts: 14

3

Monday, January 7th 2013, 4:33pm

Hi,
I'm aware of the fact that Interrupt can only be nested by interrupt of higher priority. But, what are the prerequisite to the use of Nestable Interrupt, could you provided me sample of code? Is it correctly implemented in version 3.08 ?

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 264

4

Friday, January 18th 2013, 6:11pm

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/C++ Source code

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



Regards,
Til

Vincent

Beginner

Date of registration: Dec 21st 2012

Posts: 14

5

Friday, February 8th 2013, 10:26am

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

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 264

6

Friday, February 8th 2013, 5:09pm

Helllo Vincent,

OS_Send1() is called from OS_SendString().
Do you have any call to OS_SendString() in your application?

We are not aware of any bugs with OS_SendString()/OS_Send1().

Regards,
Til

Vincent

Beginner

Date of registration: Dec 21st 2012

Posts: 14

7

Friday, February 8th 2013, 11:02pm

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

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 264

8

Monday, February 11th 2013, 9:43am

Hello Vincent,

Quoted

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

Vincent

Beginner

Date of registration: Dec 21st 2012

Posts: 14

9

Monday, February 11th 2013, 10:27am

Sorry for the post of source code.

I'll wait for your email to help me solve my problem.
But from my point of view it sounds like a critical problem as my application is completely frozen on the infinite loop I mentionned.

Vincent

Beginner

Date of registration: Dec 21st 2012

Posts: 14

10

Wednesday, August 28th 2013, 8:52am

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 ?