powerpc mvme5500 clock off by factor of 150

Kate Feng feng1 at bnl.gov
Mon Mar 7 16:57:48 UTC 2005


"Joel Sherrill " wrote:

> Kate Feng wrote:
> > Peter Dufault wrote:
> >
> >
> >>The clock on the MVME5500 seems to be off by a factor of 150.  In the
> >>"ticker" test it is taking 750 seconds instead of 5 seconds for the
> >>displays of the times.  I started fiddling constants in bspstart.c but
> >>then reading the I2C bus started to fail so I decided I had to look
> >>through things and get an overview and not continue ignorantly.
> >>
> >>I'm looking through it now, but if anyone has hints based on knowledge
> >>of the PPC decrementer and the PPC board support packages and how they
> >>support the clock (or maybe changes that went into 4.7?) on where I
> >>should look I'd appreciate it.
> >>
> >
> >
> > I  never tested the tests/samples/ticker.  However, the mvme5500 clock
> > works fine for me.  Attached is a test program I  wrote.  The test result
> > is:
>
> This is using rtems_bsp_delay.  This is not the same as the
> ticker test which uses that the clock tick device driver.
> Look in tests/samples/ticker.  You need to run it or
> you can't be sure any RTEMS time related service including
> timeouts on blocking, sleep, etc are right.
>

I do not have to test  tests/samples/ticker.  My EPICS applications
use timeouts on blocking, sleep, etc.  The clock works fine on all my
application.

Anyway, I replaced rtems_bsp_delay() with

sc = rtems_task_wake_after( 5 * rtemsTicksPerSecond_double ); /* 5 seconds */

It takes exactly 5 seconds.

*** Ticker TEST ***
Ticks per second 100.000000
 - rtems_clock_get - 09:00:05   03/07/2005
 - rtems_clock_get - 09:00:10   03/07/2005
 - rtems_clock_get - 09:00:15   03/07/2005
 - rtems_clock_get - 09:00:20   03/07/2005
 - rtems_clock_get - 09:00:25   03/07/2005
 - rtems_clock_get - 09:00:30   03/07/2005
 - rtems_clock_get - 09:00:35   03/07/2005
 - rtems_clock_get - 09:00:40   03/07/2005
 - rtems_clock_get - 09:00:45   03/07/2005
 - rtems_clock_get - 09:00:50   03/07/2005
0x00000000 (0)

Regards,
Kate


>
> --joel
>
> > Cexp>test_ticker()
> >
> >
> > *** Ticker TEST ***
> > Ticks per second 100.000000
> >  - rtems_clock_get - 09:00:00   03/07/2005
> >  - rtems_clock_get - 09:00:01   03/07/2005
> >  - rtems_clock_get - 09:00:02   03/07/2005
> >  - rtems_clock_get - 09:00:03   03/07/2005
> >  - rtems_clock_get - 09:00:04   03/07/2005
> >  - rtems_clock_get - 09:00:05   03/07/2005
> >  - rtems_clock_get - 09:00:06   03/07/2005
> >  - rtems_clock_get - 09:00:07   03/07/2005
> >  - rtems_clock_get - 09:00:08   03/07/2005
> >  - rtems_clock_get - 09:00:09   03/07/2005
> >
> >
> > Reagrds,
> > Kate
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > /*
> >  *  Simple test program -- simplified version of sample test hello.
> >  */
> >
> > #include <bsp.h>
> >
> > #include <stdio.h>
> > /*
> >  * ANSI C
> >  */
> > #include <time.h>
> > #include <limits.h>
> >
> > /*
> >  * RTEMS
> >  */
> > #include <libcpu/io.h>
> > #include <rtems.h>
> > #include <rtems/rtems_bsdnet.h>
> > #include <bsp.h>
> >
> > #define print_time(_s1, _tb, _s2) \
> >   do { \
> >     printf( "%s%02d:%02d:%02d   %02d/%02d/%04d%s", \
> >        _s1, (_tb)->hour, (_tb)->minute, (_tb)->second, \
> >        (_tb)->month, (_tb)->day, (_tb)->year, _s2 ); \
> >     fflush(stdout); \
> >   } while ( 0 )
> >
> >
> > void test_ticker()
> > {
> >   rtems_interval rtemsTicksPerSecond;
> >   double rtemsTicksPerSecond_double;
> >   int i;
> >   rtems_status_code sc;
> >   rtems_time_of_day time;
> >
> >
> >   printf( "\n\n*** Ticker TEST ***\n" );
> >   rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &rtemsTicksPerSecond);
> >   rtemsTicksPerSecond_double = rtemsTicksPerSecond;
> >   printf("Ticks per second %lf\n", rtemsTicksPerSecond_double);
> >   time.year = 2005;
> >   time.month = 3;
> >   time.day = 7;
> >   time.hour = 9;
> >   time.minute = 0;
> >   time.second = 0;
> >   time.ticks = 0;
> >   if ((sc = rtems_clock_set (&time)) != RTEMS_SUCCESSFUL)
> >      printf ("***** Can't set time: %s\n", rtems_status_text (sc));
> >
> >
> >   for (i=0; i<10; i++) {
> >      rtems_bsp_delay(1000000); /* delay 1 second */
> >
> >      sc = rtems_clock_get (RTEMS_CLOCK_GET_TOD, &time);
> >      if (sc == RTEMS_SUCCESSFUL) {
> >         print_time( " - rtems_clock_get - ", &time, "\n" );
> >      }
> >      else
> >         printf("rtems_clock_get failed %d\n", sc);
> >   }
> > }
>
> --
> Joel Sherrill, Ph.D.             Director of Research & Development
> joel at OARcorp.com                 On-Line Applications Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
>     Support Available             (256) 722-9985




More information about the users mailing list