From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32127 invoked by alias); 5 Jun 2007 04:59:27 -0000 Received: (qmail 32110 invoked by uid 22791); 5 Jun 2007 04:59:25 -0000 X-Spam-Check-By: sourceware.org Received: from mu-out-0910.google.com (HELO mu-out-0910.google.com) (209.85.134.188) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 05 Jun 2007 04:59:23 +0000 Received: by mu-out-0910.google.com with SMTP id w9so1718176mue for ; Mon, 04 Jun 2007 21:59:21 -0700 (PDT) Received: by 10.82.154.12 with SMTP id b12mr7966935bue.1181019561110; Mon, 04 Jun 2007 21:59:21 -0700 (PDT) Received: by 10.82.127.9 with HTTP; Mon, 4 Jun 2007 21:59:21 -0700 (PDT) Message-ID: <4690b0d10706042159k40c3e12cp7e92a4a4cb66d2b0@mail.gmail.com> Date: Tue, 05 Jun 2007 12:31:00 -0000 From: "M Arshad Khan" To: ecos-discuss@ecos.sourceware.org, ecos-discuss@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Drift in Real Time Clock X-SW-Source: 2007-06/txt/msg00054.txt.bz2 Message-ID: <20070605123100.J25Ttu_hFk41fmiEt2PvQHZ2pjl5otP-2cQmJinEGcg@z> 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 /* which packages are enabled/disabled */ #ifdef CYGPKG_KERNEL # include #endif #ifdef CYGPKG_LIBC # include #endif #ifdef CYGPKG_IO_SERIAL # include #endif #ifndef CYGFUN_KERNEL_API_C # error Kernel API must be enabled to build this example #endif /* INCLUDES */ #include /* printf */ #include /* strlen */ #include /* All the kernel specific stuff */ #include /* I/O functions */ #include /* CYGNUM_HAL_STACK_SIZE_TYPICAL */ #include /* 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