interrupt assistant

Beta Testing discussion on mikroPascal PRO for PIC32.
Post Reply
Author
Message
jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

interrupt assistant

#1 Post by jpc » 07 Feb 2011 13:11

as such the interrupt assistant seems a nice tool to create a ISR that at least is correctly setup but after struggling for several hours with a simple Uart-ISR that refused to trigger i have some questions here.
What is exactly are the ilevel and ics settings doing? I thought that giving the ilevel would set the priority of this ISR but that seems to be wrong. Only after configuring expolicitly in my code the IPC the interrupt started triggering
Au royaume des aveugles, les borgnes sont rois.

User avatar
mileta.miletic
mikroElektronika team
Posts: 493
Joined: 05 Jun 2009 14:46
Location: Belgrade, Serbia
Contact:

Re: interrupt assistant

#2 Post by mileta.miletic » 08 Feb 2011 09:34

jpc wrote:as such the interrupt assistant seems a nice tool to create a ISR that at least is correctly setup but after struggling for several hours with a simple Uart-ISR that refused to trigger i have some questions here.
What is exactly are the ilevel and ics settings doing? I thought that giving the ilevel would set the priority of this ISR but that seems to be wrong. Only after configuring expolicitly in my code the IPC the interrupt started triggering
Hi,

Ilevel sets the priority of ISR, but also you need to set up manually the correct priority for the used module. The priority of the module should be the same as the ISR priority.
ics is interrupt context saving, which determines the way of how the context is saved.
Regards,
Mileta

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

Re: interrupt assistant

#3 Post by jpc » 08 Feb 2011 09:43

with all respect,maybe i miss something essential but i still do not understand how this ilevel works, if i put it to zero my ISR seems to work equally well, i have the impression the priority-level is only set by the IP-bits. Maybe the interrupt-assistant could do this in the future ( not highest priority right now)
Au royaume des aveugles, les borgnes sont rois.

User avatar
mileta.miletic
mikroElektronika team
Posts: 493
Joined: 05 Jun 2009 14:46
Location: Belgrade, Serbia
Contact:

Re: interrupt assistant

#4 Post by mileta.miletic » 08 Feb 2011 17:05

jpc wrote:with all respect,maybe i miss something essential but i still do not understand how this ilevel works, if i put it to zero my ISR seems to work equally well, i have the impression the priority-level is only set by the IP-bits. Maybe the interrupt-assistant could do this in the future ( not highest priority right now)
Compiler uses ilevel value for context saving. It tells compiler priority levels of interrupt routines defined in the program, in order to do adequate context saving. Hardware priority levels are set by IP bits, like you said.
Regards,
Mileta

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

Re: interrupt assistant

#5 Post by jpc » 08 Feb 2011 18:39

ok, i understand better now but in fact this is not a very safe situation, we might have differences between ilevel and IP-settings resulting in probably impossible to debug problems. What is the safest Ilevel ? I suppose the lower the priority-level of any ISR, the more the context is at risk. In my current test ( only 3 ISR's of which 2 at the same IP-level i see no difference in the generated code if i change the ilevels. Maybe a solution is to make the ilevel available as buildin function to allow verification. Alternatively the interrupt assistant would set the IP-level based upon the ilevel parameter as passed to the assistant.
Au royaume des aveugles, les borgnes sont rois.

User avatar
rajkovic
mikroElektronika team
Posts: 694
Joined: 16 Aug 2004 12:40

Re: interrupt assistant

#6 Post by rajkovic » 09 Feb 2011 09:05

jpc wrote:ok, i understand better now but in fact this is not a very safe situation, we might have differences between ilevel and IP-settings resulting in probably impossible to debug problems. What is the safest Ilevel ? I suppose the lower the priority-level of any ISR, the more the context is at risk. In my current test ( only 3 ISR's of which 2 at the same IP-level i see no difference in the generated code if i change the ilevels. Maybe a solution is to make the ilevel available as buildin function to allow verification. Alternatively the interrupt assistant would set the IP-level based upon the ilevel parameter as passed to the assistant.

If IP-level and ilevel are not the same context saving may not work,
I agree that best situation would be that ilevel is assigned by compiler to IP-bits
we will probably implement this. But until this time comes user as is stated in help
must be carfull and ensure that ilevel and IP-bits are the same.
I will remind you that there is some vectors that has multiple sources so one ilevel determinate multiple
IP-levels. Interrupts in PIC32 are quite complex and we are working as much as we can to make them usable
by simplifying and reducing number of steps that user should be aware of.

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

Re: interrupt assistant

#7 Post by jpc » 09 Feb 2011 10:35

yes i am very aware this interrupt controller is complex, introducing the interrupt assistant tool on this family is the most difficult, on P16,P18 it is very simple, the 16 bit family's already have more complex interrupt controllers, the tool mostly makes sense if it protects us from making mistakes.
I have developped library's containing ISR's for several peripherals and i have init-functions like Init_Irq_Uart1(baudrate,Interrupt-priority), it is obvious that the Ilevel should be adapted at compile-time. Currently i cannot make this happen automatically, probably the safest is to set the Ilevel in that library to zero which i presume will do most complete context saving, however it is possibly wasting precious cpu-cycles.
Au royaume des aveugles, les borgnes sont rois.

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

Re: interrupt assistant

#8 Post by jpc » 09 Feb 2011 13:52

talking about the complexity of this interrupt-controller, in how far is this Ilevel-context saving issue related to the interrupt subpriority levels ? I realize now that probably that should be taken i account by the tool as well and here the same situation pop's up, how to know the Iplevel and sublevel at compile-time?
Au royaume des aveugles, les borgnes sont rois.

User avatar
rajkovic
mikroElektronika team
Posts: 694
Joined: 16 Aug 2004 12:40

Re: interrupt assistant

#9 Post by rajkovic » 10 Feb 2011 15:55

jpc wrote:talking about the complexity of this interrupt-controller, in how far is this Ilevel-context saving issue related to the interrupt subpriority levels ? I realize now that probably that should be taken i account by the tool as well and here the same situation pop's up, how to know the Iplevel and sublevel at compile-time?
subpriority is of no meaning for context saving, just priority is important. subpriority is used only in case when there are more than one interrupt pending with same priority to resolve which will
be executed first.

Post Reply

Return to “mikroPascal PRO for PIC32 Beta Testing”