Timer precision on at91rm9200

Rochat Joël jrochat at netplus.ch
Tue Oct 30 04:13:44 CDT 2007


Hello,

I'm working now on the rtems timers. I use an at91rm9200 with th csb337 bsp.
I generate an 1khz timer on a pio pin and i measur with an oscilloscop the
result of it. And I have a little difference with the expected value .

I measure 1,0012 ms but I shoud have 1.0 ms. 1 khz is not very high
frequency, I think it could be more precis.

I'v modified the bsp.h for my board :
#define BSP_MAIN_FREQ 20000000      /* 3.6864 MHz */
#define BSP_SLCK_FREQ   32768      /* 32.768 KHz */

I know that the bsp for csb337 was configurer with an 184 Mhz mck. My board
have an 180 Mhz mck. I didn't find where I could modifie it.

Here is a part of my code :

//definition 
#define CONFIGURE_MICROSECONDS_PER_TICK 100

//timer declaration
status = rtems_timer_create (rtems_build_name( 'T', 'A', '1', ' ' ), &timerId);
status = rtems_timer_fire_after(timerId, 10, timer1kHz, NULL);

//function called by the timer
rtems_timer_service_routine timer1kHz (rtems_id timer_id,void *user_data)
{
	if (gTick == TRUE)
	{
		*AT91C_PIOD_SODR = AT91C_PIO_PD1 ;
		gTick = FALSE ;
	}
	else
	{
		*AT91C_PIOD_CODR = AT91C_PIO_PD1 ;
		gTick = TRUE ;
	}


	rtems_timer_reset(timer_id) ;
}


I hop you can help me.

Have a nice day

Joel




More information about the rtems-users mailing list