All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Xenomai-core] Problem with periodic timer on PPC40x solved
@ 2006-09-26 14:56 gilles.chanteperdrix
  2006-09-26 16:10 ` Philippe Gerum
  0 siblings, 1 reply; 24+ messages in thread
From: gilles.chanteperdrix @ 2006-09-26 14:56 UTC (permalink / raw)
  To: rpm; +Cc: xenomai-core

---------- Debut du message initial -----------

De     : xenomai-core-bounces@domain.hid
A      : niklaus.giger@domain.hid
Copies : xenomai@xenomai.org
Date   : Tue, 26 Sep 2006 16:21:18 +0200
Objet  : Re: [Xenomai-core] Problem with periodic timer on
PPC40x solved

> > On Mon, 2006-09-25 at 22:29 +0200, Niklaus Giger wrote:
> > > > Am Montag, 25. September 2006 17:57 schrieb Philippe
Gerum:
> > > > > On Sun, 2006-09-24 at 23:07 +0200, Wolfgang
Grandegger wrote:
> > > > > > Niklaus Giger wrote:
> > <..>
> > > > Is the output of lines like "Xenomai: Switching
display-3238 to secondary
> > > > mode after exception #1025 from user-space at
0x100033c4 (pid 3240)"
> > > > harmless or the result of a activated
CONFIG_XENO_OPT_DEBUG<..> option?
>
> A known hw issue seems to exist with the 405GP (revD), which
causes the
> ESR to be incorrectly set upon FPU emulation trap, which
would in turn
> cause the spurious exception to be relayed to the nucleus by
Adeos. The
> patch below is _not_ the final fix, but rather a way to
check if this
> message is indeed related to the FPU emulation on your
board. Does it
> silence the exception without breaking the box?

The FPU fault may be the result of the latency display thread
using the
FPU: on systems with emulated FPU, this looks normal.

--
                 Gilles Chanteperdrix

Accédez au courrier électronique de La Poste
sur www.laposte.net ou sur 3615 LAPOSTENET (0,34€ TTC /mn)
1 Giga de stockage gratuit – Antispam et antivirus intégrés





^ permalink raw reply	[flat|nested] 24+ messages in thread
* [Xenomai-core] Problem with periodic timer on PPC40x identified
@ 2006-09-23 18:13 Niklaus Giger
  2006-09-23 20:55 ` Wolfgang Grandegger
  0 siblings, 1 reply; 24+ messages in thread
From: Niklaus Giger @ 2006-09-23 18:13 UTC (permalink / raw)
  To: xenomai

Hi

Finally I got some time to debug the whole problem with my BDI.
I see that in hal.c thal_set_local_cpu_timer the PIT is loaded with a value of 
568 which is far too low, as the PIT is running at 400 MHz. So it will 
trigger an interrupt every 1,4 microsecond and therefore overload the system.

I am not sure about the time units stored in __ipipe_decr_ticks. I tried to 
use 400 as my board is running at 400 MHz.
A quick breakpoint in ppc4xx_calibrate_decr in the file 
arch/syslib/ppc4xx_setup.c verified that bdinfo has the correct value of 
400'000'000 as frequency.

In hal.c and ipipe-core are two occurences of
    mtspr(SPRN_PIT, __ipipe_decr_ticks); 
which I replaced by the above computed constant
    mtspr(SPRN_PIT, __ipipe_decr_ticks * 400); 

Now the the board comes up, but calling in the vxworks skin 
taskDelay(sysClkRateGet()*10) delays me only about 5 seconds and not 10 as 
expected.

I have one possible explanation that the value of 568 is the result of a 
implicit truncation to 32 bits in ipipe_tune_timer. tb_ticks_per_jiffy is 
1600000, sysClkRate is 10000. Therefore a maximal delay of 1 ms = 1000*1000 
ns leads to 1000*1000*16000 = 0x25'40BE'4000.

If would be nice if somebode could shed some light on this issue.

My preliminary patch looked like this, but I am sure that we need quite a 
different solution.

+++ ksrc/arch/powerpc/hal.c	(Arbeitskopie)
@@ -81,7 +81,9 @@
  */
 static void rthal_set_local_cpu_timer(void)
 {
+#ifndef CONFIG_40x
     long ticks;
+#endif
     rthal_declare_cpuid;
 
     rthal_load_cpuid();
@@ -90,7 +92,7 @@
 #ifdef CONFIG_40x
     /* Enable and set auto-reload. */
     mtspr(SPRN_TCR, mfspr(SPRN_TCR) | TCR_ARE);
-    mtspr(SPRN_PIT, __ipipe_decr_ticks);
+    mtspr(SPRN_PIT, __ipipe_decr_ticks * 400); /* TODO: How do we get this 
value from the board info */
 #else /* !CONFIG_40x */
     ticks = (long)(__ipipe_decr_next[cpuid] - __ipipe_read_timebase());
     set_dec(ticks > 0 ? ticks : 0);
Index: ksrc/arch/powerpc/patches/adeos-ipipe-2.6.14-ppc-1.4-00.patch
===================================================================
--- ksrc/arch/powerpc/patches/adeos-ipipe-2.6.14-ppc-1.4-00.patch	(Revision 
1650)
+++ ksrc/arch/powerpc/patches/adeos-ipipe-2.6.14-ppc-1.4-00.patch	
(Arbeitskopie)
@@ -3581,7 +3581,8 @@
 +#ifdef CONFIG_40x
 +	/* Enable and set auto-reload. */
 +	mtspr(SPRN_TCR, mfspr(SPRN_TCR) | TCR_ARE);
-+	mtspr(SPRN_PIT, __ipipe_decr_ticks);
++	mtspr(SPRN_PIT, __ipipe_decr_ticks * 400 ); /* TODO: How do we get this 
value from the board info */
+
 +#else	/* !CONFIG_40x */
 +	__ipipe_decr_next[cpuid] = __ipipe_read_timebase() + __ipipe_decr_ticks;
 +	set_dec(__ipipe_decr_ticks);

Best regards

-- 
Niklaus Giger


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2006-09-28  7:59 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-26 14:56 [Xenomai-core] Problem with periodic timer on PPC40x solved gilles.chanteperdrix
2006-09-26 16:10 ` Philippe Gerum
2006-09-26 16:28   ` Wolfgang Grandegger
2006-09-26 16:38     ` Philippe Gerum
2006-09-26 16:57       ` Wolfgang Grandegger
2006-09-26 18:56     ` Niklaus Giger
2006-09-26 20:23       ` Wolfgang Grandegger
2006-09-26 21:26         ` Niklaus Giger
2006-09-27 10:13           ` Wolfgang Grandegger
2006-09-27 18:19             ` Wolfgang Grandegger
2006-09-28  6:02               ` Niklaus Giger
2006-09-28  7:59                 ` Wolfgang Grandegger
  -- strict thread matches above, loose matches on Subject: below --
2006-09-23 18:13 [Xenomai-core] Problem with periodic timer on PPC40x identified Niklaus Giger
2006-09-23 20:55 ` Wolfgang Grandegger
2006-09-24 20:47   ` [Xenomai-core] Problem with periodic timer on PPC40x solved Niklaus Giger
2006-09-24 21:07     ` Wolfgang Grandegger
2006-09-25 15:57       ` Philippe Gerum
2006-09-25 20:29         ` Niklaus Giger
2006-09-25 20:59           ` Philippe Gerum
2006-09-25 21:15             ` Niklaus Giger
2006-09-26  6:59               ` Philippe Gerum
2006-09-26 14:21               ` Philippe Gerum
2006-09-26 18:39                 ` Niklaus Giger
2006-09-26 19:34               ` Niklaus Giger
2006-09-26 19:48                 ` Philippe Gerum
2006-09-26  6:47           ` Wolfgang Grandegger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.