EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Nested interrupt

Started by thiru_vid December 5, 2009
Timer1 ISR
 _______________________________________________________________
|							        |           
|							        |___________			
<----Do some calculation it takes around 8us with in timer 1-->
<---------    Each and every 10us, the timer 1 ISR is executed  
----------->



Timer 3 ISR
 _________	 _________	 ________	 _________	 ________
|	  |	|	  |   	|	 |    	|	  |   	|	     |	  |_____|	  |_____|       
|______|	  |_____|        |
<---1.5--->
<-----2us------->

I am using TMS320F2812 microcontroller.
i need to implement the timer 3 ISR are executed within Timer 1 ISR. Is it
possible to implement the same?
Any one can you please help me for that.


	   
					
---------------------------------------		
This message was sent using the comp.arch.embedded web interface on
http://www.EmbeddedRelated.com
On Sat, 05 Dec 2009 09:08:50 -0600, "thiru_vid" <thiru_vid@yahoo.co.in>
wrote:

>Timer1 ISR > _______________________________________________________________ >| | >| |___________ ><----Do some calculation it takes around 8us with in timer 1--> ><--------- Each and every 10us, the timer 1 ISR is executed >-----------> > > > >Timer 3 ISR > _________ _________ ________ _________ ________ >| | | | | | | | | | |_____| |_____| >|______| |_____| | ><---1.5---> ><-----2us-------> > >I am using TMS320F2812 microcontroller. >i need to implement the timer 3 ISR are executed within Timer 1 ISR. Is it >possible to implement the same? >Any one can you please help me for that.
A dual core? An FPGA? Otherwise, as described, I don't see it as possible. If Timer3 preempts Timer1, leaving 0.5 usec out of every 2.0 usec available for Timer1 (not counting overhead), then Timer1's task will take 32 usec to complete a single calculation. QED SOL. -- Rich Webb Norfolk, VA
On Dec 5, 10:13=A0pm, Rich Webb <bbew...@mapson.nozirev.ten> wrote:
> On Sat, 05 Dec 2009 09:08:50 -0600, "thiru_vid" <thiru_...@yahoo.co.in> > wrote: > > > > > > >Timer1 ISR > > _______________________________________________________________ > >| =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =A0 =A0 =A0 =A0
> >| =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |___________ =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0
> ><----Do some calculation it takes around 8us with in timer 1--> > ><--------- =A0 =A0Each and every 10us, the timer 1 ISR is executed =A0 > >-----------> > > >Timer 3 ISR > > _________ =A0 _________ =A0 =A0 =A0 ________ =A0 =A0 =A0 =A0_________ =
=A0 =A0 =A0 ________
> >| =A0 =A0 | =A0 =A0 | =A0 =A0 =A0 =A0 | =A0 =A0 | =A0 =A0 =A0 =A0| =A0 =
=A0 =A0| =A0 =A0 =A0 =A0 | =A0 =A0 | =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A0|_____= | =A0 =A0 =A0 =A0 |_____| =A0 =A0 =A0
> >|______| =A0 =A0 =A0|_____| =A0 =A0 =A0 =A0| > ><---1.5---> > ><-----2us-------> > > >I am using TMS320F2812 microcontroller. > >i need to implement the timer 3 ISR are executed within Timer 1 ISR. Is =
it
> >possible to implement the same? > >Any one can you please help me for that. > > A dual core? An FPGA? Otherwise, as described, I don't see it as > possible. If Timer3 preempts Timer1, leaving 0.5 usec out of every 2.0 > usec available for Timer1 (not counting overhead), then Timer1's task > will take 32 usec to complete a single calculation. QED SOL. >
But, if there is no preemption, then it should be feasible as Timer3 occurs every 2 us while Timer1 occurs only every 10us. But, i wonder how it will be able to function when it is in the 5th interval because during that scenario/occassion, timer3 and timer1 will both be trying to get executed and some kind of racing might happen . Any ideas ? Karthik Balaguru
Yes

Use software interrupt priority.

You must use Software Prioritized Interrupt PIE Block Specific Support 
Files.

Read SPRC097.

On Sun, 6 Dec 2009 09:07:27 -0800 (PST), karthikbalaguru
<karthikbalaguru79@gmail.com> wrote:

>On Dec 5, 10:13&#4294967295;pm, Rich Webb <bbew...@mapson.nozirev.ten> wrote: >> On Sat, 05 Dec 2009 09:08:50 -0600, "thiru_vid" <thiru_...@yahoo.co.in> >> wrote: >> >> >> >> >> >> >Timer1 ISR >> > _______________________________________________________________ >> >| &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; | &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; >> >| &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; |___________ &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; >> ><----Do some calculation it takes around 8us with in timer 1--> >> ><--------- &#4294967295; &#4294967295;Each and every 10us, the timer 1 ISR is executed &#4294967295; >> >-----------> >> >> >Timer 3 ISR >> > _________ &#4294967295; _________ &#4294967295; &#4294967295; &#4294967295; ________ &#4294967295; &#4294967295; &#4294967295; &#4294967295;_________ &#4294967295; &#4294967295; &#4294967295; ________ >> >| &#4294967295; &#4294967295; | &#4294967295; &#4294967295; | &#4294967295; &#4294967295; &#4294967295; &#4294967295; | &#4294967295; &#4294967295; | &#4294967295; &#4294967295; &#4294967295; &#4294967295;| &#4294967295; &#4294967295; &#4294967295;| &#4294967295; &#4294967295; &#4294967295; &#4294967295; | &#4294967295; &#4294967295; | &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;| &#4294967295; &#4294967295;|_____| &#4294967295; &#4294967295; &#4294967295; &#4294967295; |_____| &#4294967295; &#4294967295; &#4294967295; >> >|______| &#4294967295; &#4294967295; &#4294967295;|_____| &#4294967295; &#4294967295; &#4294967295; &#4294967295;| >> ><---1.5---> >> ><-----2us-------> >> >> >I am using TMS320F2812 microcontroller. >> >i need to implement the timer 3 ISR are executed within Timer 1 ISR. Is it >> >possible to implement the same? >> >Any one can you please help me for that. >> >> A dual core? An FPGA? Otherwise, as described, I don't see it as >> possible. If Timer3 preempts Timer1, leaving 0.5 usec out of every 2.0 >> usec available for Timer1 (not counting overhead), then Timer1's task >> will take 32 usec to complete a single calculation. QED SOL. >> >But, if there is no preemption, then it should be feasible as >Timer3 occurs every 2 us while Timer1 occurs only every 10us.
If there is no preemption, then Timer3 won't be executed within Timer1. If there is, Timer1 won't complete its 8 usecs of calculations before the Timer1 interrupt fires again. One or the other, not both. -- Rich Webb Norfolk, VA
On Sun, 06 Dec 2009 09:07:27 -0800, karthikbalaguru wrote:

> On Dec 5, 10:13&#4294967295;pm, Rich Webb <bbew...@mapson.nozirev.ten> wrote: >> On Sat, 05 Dec 2009 09:08:50 -0600, "thiru_vid" <thiru_...@yahoo.co.in> >> wrote: >> >> >> >> >> >> >Timer1 ISR >> > _______________________________________________________________ >> >| &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; | &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; >> >| &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; |___________ &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; >> ><----Do some calculation it takes around 8us with in timer 1--> >> ><--------- &#4294967295; &#4294967295;Each and every 10us, the timer 1 ISR is executed &#4294967295; >> >-----------> >> >> >Timer 3 ISR >> > _________ &#4294967295; _________ &#4294967295; &#4294967295; &#4294967295; ________ &#4294967295; &#4294967295; &#4294967295; &#4294967295;_________ &#4294967295; &#4294967295; &#4294967295; ________ >> >| &#4294967295; &#4294967295; | &#4294967295; &#4294967295; | &#4294967295; &#4294967295; &#4294967295; &#4294967295; | &#4294967295; &#4294967295; | &#4294967295; &#4294967295; &#4294967295; &#4294967295;| &#4294967295; &#4294967295; &#4294967295;| &#4294967295; &#4294967295; &#4294967295; &#4294967295; | &#4294967295; &#4294967295; | &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;| &#4294967295; &#4294967295;|_____| &#4294967295; &#4294967295; &#4294967295; &#4294967295; |_____| &#4294967295; &#4294967295; &#4294967295; >> >|______| &#4294967295; &#4294967295; &#4294967295;|_____| &#4294967295; &#4294967295; &#4294967295; &#4294967295;| >> ><---1.5---> >> ><-----2us-------> >> >> >I am using TMS320F2812 microcontroller. >> >i need to implement the timer 3 ISR are executed within Timer 1 ISR. Is it >> >possible to implement the same? >> >Any one can you please help me for that. >> >> A dual core? An FPGA? Otherwise, as described, I don't see it as >> possible. If Timer3 preempts Timer1, leaving 0.5 usec out of every 2.0 >> usec available for Timer1 (not counting overhead), then Timer1's task >> will take 32 usec to complete a single calculation. QED SOL. >> > But, if there is no preemption, then it should be feasible as > Timer3 occurs every 2 us while Timer1 occurs only every 10us. > But, i wonder how it will be able to function when it is in the > 5th interval because during that scenario/occassion, timer3 and > timer1 will both be trying to get executed and some kind of racing > might happen . Any ideas ?
No, as described, Timer1 takes 80% CPU time (8us every 10us), and Timer3 takes 75% CPU Time (1.5 every 2). Those add up to more than 100%.
On Dec 7, 12:41=A0am, Rich Webb <bbew...@mapson.nozirev.ten> wrote:
> On Sun, 6 Dec 2009 09:07:27 -0800 (PST), karthikbalaguru > > > > > > <karthikbalagur...@gmail.com> wrote: > >On Dec 5, 10:13=A0pm, Rich Webb <bbew...@mapson.nozirev.ten> wrote: > >> On Sat, 05 Dec 2009 09:08:50 -0600, "thiru_vid" <thiru_...@yahoo.co.in= > > >> wrote: > > >> >Timer1 ISR > >> > _______________________________________________________________ > >> >| =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =A0 =A0 =A0 =A0
> >> >| =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |___________ =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0
> >> ><----Do some calculation it takes around 8us with in timer 1--> > >> ><--------- =A0 =A0Each and every 10us, the timer 1 ISR is executed =
=A0
> >> >-----------> > > >> >Timer 3 ISR > >> > _________ =A0 _________ =A0 =A0 =A0 ________ =A0 =A0 =A0 =A0________=
_ =A0 =A0 =A0 ________
> >> >| =A0 =A0 | =A0 =A0 | =A0 =A0 =A0 =A0 | =A0 =A0 | =A0 =A0 =A0 =A0| =
=A0 =A0 =A0| =A0 =A0 =A0 =A0 | =A0 =A0 | =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A0|_= ____| =A0 =A0 =A0 =A0 |_____| =A0 =A0 =A0
> >> >|______| =A0 =A0 =A0|_____| =A0 =A0 =A0 =A0| > >> ><---1.5---> > >> ><-----2us-------> > > >> >I am using TMS320F2812 microcontroller. > >> >i need to implement the timer 3 ISR are executed within Timer 1 ISR. =
Is it
> >> >possible to implement the same? > >> >Any one can you please help me for that. > > >> A dual core? An FPGA? Otherwise, as described, I don't see it as > >> possible. If Timer3 preempts Timer1, leaving 0.5 usec out of every 2.0 > >> usec available for Timer1 (not counting overhead), then Timer1's task > >> will take 32 usec to complete a single calculation. QED SOL. > > >But, if there is no preemption, then it should be feasible as > >Timer3 occurs every 2 us while Timer1 occurs only every 10us. > > If there is no preemption, then Timer3 won't be executed within Timer1. > If there is, Timer1 won't complete its 8 usecs of calculations before > the Timer1 interrupt fires again. One or the other, not both. >
Hmm,Agreed. Did not notice that even though the processing time of timer3 is 1.5us only, the timer3 occurs every 2us. Karthik Balaguru

The 2024 Embedded Online Conference