From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Grandegger Subject: Re: [SocketCan] Problem of accuracy Date: Sun, 08 Jul 2012 22:13:24 +0200 Message-ID: <4FF9E9E4.4090602@grandegger.com> References: <4FF55274.3030006@volkswagen.de> <4FF8102C.8030609@grandegger.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from ngcobalt02.manitu.net ([217.11.48.102]:55132 "EHLO ngcobalt02.manitu.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751938Ab2GHUNa (ORCPT ); Sun, 8 Jul 2012 16:13:30 -0400 In-Reply-To: Sender: linux-can-owner@vger.kernel.org List-ID: To: Mohamed HAMZAOUI Cc: Oliver Hartkopp , linux-can Mailing List On 07/08/2012 09:43 PM, Mohamed HAMZAOUI wrote: > Hi, >=20 >> This problem is not CAN related. Anyway, you can read/try/check: >> >> - are high-resolution timers enabled in your kernel? >=20 > My high resolution timers is enabled in Kernel and i activate > Preemptible kernel (low latency desktop) >=20 >> - use cyclictest [1] to measure user-space timing accuracy. >=20 > the cyclictest mesure with 0% load is 307 in maximum You mean 302 us? Did you generate some load? That normally makes a big difference. >=20 >> - use clock_nanosleep for periodic tasks. >=20 > i use clock_nanosleep with (1000000 ns =3D 1ms) and the result mesure= d > with another CAN transeiver is an average of 1.30 ms (delta =3D 300 =B5= s) > ! That means that you see a period of 1.3ms instead of 1ms? That's really strange. I assume that the timing on the system with the other CAN transceiver is accurate. >> - try to start cangen with "chrt -f 10 cangen can0". >=20 > no effect. >=20 >> - read "man sched_setscheduler" for a description of the Linux >> scheduling scheme. >=20 > I test with two type of SCHED : RR and FIFO but the result is same >=20 > Maybe i need to pass to Xenomai or PREEMPT-RT ? What system, kernel and CAN controller do you use? Is it an MCP25xx? Wolfgang.