powerpc mvme5500 clock off by factor of 150
Kate Feng
feng1 at bnl.gov
Mon Mar 7 14:19:30 UTC 2005
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:
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
-------------- next part --------------
/*
* 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);
}
}
More information about the users
mailing list