From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 962 invoked by alias); 1 Jan 2016 18:00:33 -0000 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 Received: (qmail 946 invoked by uid 89); 1 Jan 2016 18:00:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_50,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Accept-Language:en-us, programmed, Hx-languages-length:1750, drives X-HELO: mail.ecoscentric.com Received: from albus.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.200) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 01 Jan 2016 18:00:31 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id CEB6CA800BC; Fri, 1 Jan 2016 18:00:27 +0000 (GMT) Received: from mail.ecoscentric.com ([127.0.0.1]) by localhost (albus.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M7ksz1Xa8kcd; Fri, 1 Jan 2016 18:00:26 +0000 (GMT) Message-ID: <5686BEB9.5050606@eCosCentric.com> DKIM-Filter: OpenDKIM Filter v2.10.3 mail.ecoscentric.com 68FEAA805C7 Date: Fri, 01 Jan 2016 18:00:00 -0000 From: Jonathan Larmour User-Agent: Mozilla Thunderbird 1.0.8-1.1.fc3.4.legacy (X11/20060515) MIME-Version: 1.0 To: Privat CC: ecos-discuss@ecos.sourceware.org References: <56728F18.1040409@gmx.de> In-Reply-To: <56728F18.1040409@gmx.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [ECOS] Real Time Clock X-SW-Source: 2016-01/txt/msg00000.txt.bz2 Privat wrote: > Dear Ecos Developers and Maintainers, > > i have a question regarding the real time clock. > I have a FreeSacle which runs at 116 Mhz, which means i have 1 000 000 > 000 ns / 116 000 000 or 8ns per cycle. > > I set the dividend to 1000, and the divisor to 116 which following the > documentation (http://ecos.sourceware.org/docs-2.0/ref/kernel-clocks.html) > - should always yield the ratio of ns between clock ticks. > Unfortunatly that does not result in correct values. The kernel real time clock doesn't run at 116 MHz though! The clock speed for the processor is different from the clock you want the kernel to use to measure time - the latter drives a clock interrupt that is used to handle e.g. kernel alarms or timeslicing. You can't have a tick (and therefore a clock interrupt) every CPU cycle :-). You would need to set it to the number of nanoseconds per clock interrupt you would get when the clock setting given by CYGNUM_HAL_RTC_PERIOD is programmed into the PowerPC decrementer. I don't know your HAL, but if it is derived from the MPC5554demo HAL, which seems most likely, CYGNUM_HAL_RTC_PERIOD defaults to the expression (CYGHWR_HAL_POWERPC_MPC55XX_FSYS/CYGNUM_HAL_RTC_DENOMINATOR) (with name changed for you) so that it becomes easy to make the denominator correspond to the kernel clock frequency you want. In other words, if you want the standard 100Hz kernel clock tick, you probably do indeed want to leave it as it is. Jifl -- eCosCentric Limited http://www.eCosCentric.com/ The eCos experts Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571 Registered in England and Wales: Reg No 4422071. ------["Si fractum non sit, noli id reficere"]------ Opinions==mine -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss