public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Drift in Real Time Clock
@ 2007-06-05  4:59 M Arshad Khan
  2007-06-05 12:31 ` M Arshad Khan
  2007-06-05 17:49 ` Andrew Lunn
  0 siblings, 2 replies; 8+ messages in thread
From: M Arshad Khan @ 2007-06-05  4:59 UTC (permalink / raw)
  To: ecos-discuss, ecos-discuss

Hello
we r running eCos on simple intel based PC. we want to find the drift
in the real time colck, for this we simply capture a 100Sec signal
using 20mSec interrupt. the signal was captured using a counter by
triggering the channel of the counter using parallel port of the PC.
the code is given below.
from the results we found that  the drift was 7mili Sec in 100 Sec.
This drift is very large to fitt for real time colck. we also tried
this code on different PC's but app same results. can any body tell me
why i am getting so much drift...
any suggestions..



#include <pkgconf/system.h>     /* which packages are enabled/disabled */
#ifdef CYGPKG_KERNEL
# include <pkgconf/kernel.h>
#endif
#ifdef CYGPKG_LIBC
# include <pkgconf/libc.h>
#endif
#ifdef CYGPKG_IO_SERIAL
# include <pkgconf/io_serial.h>
#endif

#ifndef CYGFUN_KERNEL_API_C
# error Kernel API must be enabled to build this example
#endif
/* INCLUDES */

#include <stdio.h>                      /* printf */
#include <string.h>                     /* strlen */
#include <cyg/kernel/kapi.h>            /* All the kernel specific stuff */
#include <cyg/io/io.h>                  /* I/O functions */
#include <cyg/hal/hal_arch.h>           /* CYGNUM_HAL_STACK_SIZE_TYPICAL */

#include <cyg/hal/hal_io.h>		/* HAL input and output */

cyg_uint8 val;

cyg_handle_t counter_hdl;
cyg_handle_t sys_clk;
cyg_handle_t alarm_hdl;
cyg_alarm_t alarm_handler;
cyg_alarm alarm_obj;

unsigned long iindex;
unsigned long ccount=0;
//
// Main starting point for the application.
//

void cyg_user_start( void )
{
	HAL_WRITE_UINT8(0x378,0x00);
        sys_clk = cyg_real_time_clock();

        cyg_clock_to_counter( sys_clk,&counter_hdl );

        cyg_alarm_create(
counter_hdl,alarm_handler,(cyg_addrword_t)&iindex,&alarm_hdl,&alarm_obj
);

        cyg_alarm_initialize( alarm_hdl,cyg_current_time() + 200,2 );



}

//
// Alarm handler.
//

void alarm_handler(cyg_handle_t alarm_handle, cyg_addrword_t data )
{
	if(ccount==0)
	{
		    	HAL_WRITE_UINT8(0x378,0x01);	      	
	}
		
	if(ccount==(100*50))
	{
		    	HAL_WRITE_UINT8(0x378,0x02);	      	
	}
	ccount++;
}

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

end of thread, other threads:[~2007-06-06 10:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-05  4:59 [ECOS] Drift in Real Time Clock M Arshad Khan
2007-06-05 12:31 ` M Arshad Khan
2007-06-05 17:49 ` Andrew Lunn
2007-06-05 18:31   ` Andrew Lunn
2007-06-06 10:33   ` M Arshad Khan
2007-06-06 10:37     ` M Arshad Khan
2007-06-06 12:20     ` Nick Garnett
2007-06-06 14:29       ` Nick Garnett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).