Page 1 of 1

e200 INTC prio LIFO not popped (INTC_EOIR not written)

Posted: Mon Sep 02, 2013 3:20 pm
by maximevince
Dear EE users, community,

I have experimented with the EE kernel om my MPC5643L devboard, with great appreciation of the incredible work, efficiency and easy of use of the EE RTOS.

I started from a demo generated by Eclipse, using ISR_dynamic_table.
However, my application needs the least ISR jitter possible. As we are running a very time critical ISR. (just 2 time critical isrs, the rest is less time critical).
Therefor, I converted my conf.oil to use static interrupt table.

Howver, then I get following problem: The ISR fires only once, then never again. Looking at INTC_CPR, I see it is "stuck" at 7, which is the ISR priority of my interrupt that fired once. This is typical, when the priority LIFO of the INTC did not get popped.

Looking at ee_irq.c in pkg/cpu/e200zx/src, I found indeed that EE_e200z7_irq(EE_SREG level) does not pop the LIFO by writing to INTC_EOIR.R.
(The EE_e200z7_irq version for static ISR tables). In fact this version of the function does a lot less, but a critical part is therefor missing....

Or am I missing something here?

Adding

Code: Select all

  	/* Pop priority for external interrupts */
	if (level >= EE_E200ZX_MAX_CPU_EXCP) {
		/* Look at reference manual:
			 9.4.3.1.2 End-of-Interrupt Exception Handler NOTE
		*/
		EE_e200zx_mbar();
		INTC_EOIR.R = 0U;
	}
Solved the problem, but I don't know if that's enough?
Furthermore, I would also like to have ISR nesting in static interrupt table mode... Is that feature implemented? If not, I can have a go at it, to implement it, but I would need at least some assistance, and additional info on the current status.

Eagerly awaiting your replies,
Maxime Vincent

Re: e200 INTC prio LIFO not popped (INTC_EOIR not written)

Posted: Mon Sep 02, 2013 5:10 pm
by e.guidieri
Hi Maxime,

I think that when you switched from dinamyc to static ISR you forgot to wrap your handlers in the right Macros (that add the right pre and post handler's code).

So to declare a static handler of ISR1 type you have to write:

Code: Select all

  ISR1(isr1_handler) {
   /* handler code */
  }
and similiar for ISR2:

Code: Select all

  ISR2(isr2_handler) {
   /* handler code */
  }
If you are using directly DECREMENTER and FIXED_INTV sources, there are other two macros to be used because those sources are not external interrupt but core exception instead.

e.g:

Code: Select all

  ISR1_INT(decrementer_handler) {
    /* decrementer handler  */
  }
or

Code: Select all

  ISR2_INT(decrementer_handler) {
    /* decrementer handler  */
  }

These macros have suffix *_INT that means internal use, because you should not use directly those sources.

Instead you should leave them to the kernel and using it indirectly declaring the system timer counter.

I hope this was helpful,
Errico Guidieri.

Re: e200 INTC prio LIFO not popped (INTC_EOIR not written)

Posted: Tue Sep 03, 2013 8:29 am
by maximevince
Hi Errico,

Thanks for the clear, fast response!
That does fix the EOIR issue indeed.

However, I'm not able to get the COUNTER system_timer to work.
Adding the section suggested on the wiki to my oil.conf,
results in following error message:

Code: Select all

ERROR > Some errors : Expected a CLOCK for cpu default_cp
I have been trying to add CLOCK to the COUNTER section or the CPU_DATA section, but that won't work.
Additionally, I cannot find anything about "CLOCK" in the RT_Druid Reference manual, either.
What am I missing here?

Re: e200 INTC prio LIFO not popped (INTC_EOIR not written)

Posted: Tue Sep 03, 2013 9:16 am
by fesposito
Hi,

Add the following in CPU_DATA:

CPU_DATA = PPCE200ZX {
CPU_CLOCK = 120.0; // required by system timer
MODEL = E200Z4;
...
...

A detailed description has been added in the Erika wiki describing system timer configuration under PowerPC.

Francesco

Regards

Francesco

Re: e200 INTC prio LIFO not popped (INTC_EOIR not written)

Posted: Tue Sep 03, 2013 5:20 pm
by maximevince
Hi Francesco,

Thanks for the reply, and for updating the wiki right away!

I am however running the FR kernel, and can therefor not use this way to define the decrementer ISR, as it depends on structs like EE_oo_counter_hw_ROM_type,
which are only defined for the OO-kernel variants.

I'm using the ENTRY = "DECREMENTER"; method now, and declaring my Counter_Interrupt using ISR1_INT(), which does the trick.

Thanks!
Best regards,
Maxime Vincent

Re: e200 INTC prio LIFO not popped (INTC_EOIR not written)

Posted: Tue Sep 03, 2013 6:08 pm
by e.guidieri
Hi Maxime,

can you explain what you get when you configure the system timer for FP, because it sounds like a RT-Druid bug: it should not generate EE_oo_counter_hw_ROM structure for FP kernel.

Could you please try to edit eecfg.c removing the EE_oo_counter_hw_ROM structure and tell us if your code works?

By the way be aware that if you are using the DECREMENTER to drive a counter (with CounterTick primitive) or to interact with kernel in other way (e.g with ActivateTask) you have to declare the handler with ISR2_INT macro, otherwise you won't get rescheduling at the end of the handler.

Best Regards,
Errico Guidieri

Re: e200 INTC prio LIFO not popped (INTC_EOIR not written)

Posted: Wed Sep 04, 2013 7:38 am
by maximevince
Hey Errico,

I have commented out these generated sections in eecfg.c:

Code: Select all

    const EE_oo_counter_hw_ROM_type EE_counter_hw_ROM[] = {
        {1000U}         /* system_timer */
    };
    EE_counter_RAM_type       EE_counter_RAM[EE_MAX_COUNTER] = {
        {0, -1}         /* system_timer */
    };
Then, the compiler complains about "OSTICKDURATION" which it cannot find and the CounterTick prototype:

Code: Select all

"w:\\ETPU7B~J\\EBNHW0~H\\plugins\\CY6Z17~A\\ee_files\\pkg\\cpu\\e200zx\\src\\ee_system_timer.c", line 71: error (dcc:1500): function CounterTick has no prototype
"w:\\ETPU7B~J\\EBNHW0~H\\plugins\\CY6Z17~A\\ee_files\\pkg\\cpu\\e200zx\\src\\ee_system_timer.c", line 84: error (dcc:1525): identifier OSTICKDURATION not declared
make: *** [obj/pkg/cpu/e200zx/src/ee_system_timer.o] Error 1
BR,
Maxime

Re: e200 INTC prio LIFO not popped (INTC_EOIR not written)

Posted: Wed Sep 04, 2013 9:37 am
by e.guidieri
Thank you,

I understood wich is the poblem, in fact to support system timer that structure is needed so I have to add the type to FP alarms.

Best Regards,
Errico Guidieri