On Sat, 2007-03-03 at 11:44 +0100, Laurent Pinchart wrote:

> I'm trying to find a way to synchronise the Linux system clock with a device 
> clock using the USB frame counter as a shared clock.

In a related scenario I have an USB device that periodically sends its
device clock over USB and I wanted to relate that clock to the system
clock. I did it without involving the USB frame clock, however (maybe
you can reduce the jitter of the time measurements if you do).

I modelled the relationships of the device clock (y) to the system clock
(x) as a linear one:

y =~ ax+b

Whenever the device sends its device clock value, I obtain a system
clock sample and process it as a pair (x_i, y_i).

>From multiple of these pairs, you can then compute estimates for a and
b, eg. using a least-squares criterion.

I ended up doing recursive least squares with a forgetting factor. I.e.
the estimates for a and b are updated whenever a new measurement (x_i,
y_i) arrives.

>From the estimates a and b you can convert time instants between the two
clocks.

There's lots of documentation on RLS if you google on the web, eg.
http://www.cs.tut.fi/~tabus/course/ASP/LectureNew10.pdf

Tom



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to