Author Topic: Synchronisation of clock between host and device on USB  (Read 4724 times)

cb

  • Member
  • ***
  • Posts: 6
Synchronisation of clock between host and device on USB
« on: May 09, 2020, 07:04:22 pm »
Hi, is it possible to sync the clock across the host and the device on a USB network? I need to connect a sensor where the time of sensor measurement is extremely critical and must be communicated to the host. I was thinking of vendor defined USB HID spec and creating reports for the time and sensor data. However, If the time is not synced between the host and the device, I am afraid that there will be a lot of false time readings. 

Is there any USB spec that defines time and clock synchronisation between a host and a device? Thanks.
« Last Edit: May 09, 2020, 07:40:43 pm by cb »

towlerg

  • Member
  • ***
  • Posts: 24
Re: Synchronisation of clock between host and device on USB
« Reply #1 on: May 10, 2020, 08:00:43 am »
If the device had both data and accurate time, why not send both together. Only downside is a little more data (you send time with every packet).

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Synchronisation of clock between host and device on USB
« Reply #2 on: May 10, 2020, 11:46:45 am »
Yes, if the device knows the absolute time, it can send that information in a report with the sensor data.

If the device doesn't know the time, the host could send time information periodically in interrupt or isochronous transfers, and the device could send the most recent received time with the sensor data. Whether that is feasible would depend on how precise the time measurement needs to be. 


cb

  • Member
  • ***
  • Posts: 6
Re: Synchronisation of clock between host and device on USB
« Reply #3 on: May 10, 2020, 10:00:39 pm »
the host could send time information periodically in interrupt or isochronous transfers,

Thanks for the idea, I will try to prototype this.

cb

  • Member
  • ***
  • Posts: 6
Re: Synchronisation of clock between host and device on USB
« Reply #4 on: May 10, 2020, 10:01:23 pm »
If the device had both data and accurate time, why not send both together. Only downside is a little more data (you send time with every packet).

Thanks towlerg, the assumption is that the device does not have accurate time and needs to sync the clock with the host.

towlerg

  • Member
  • ***
  • Posts: 24
Re: Synchronisation of clock between host and device on USB
« Reply #5 on: May 11, 2020, 07:29:44 am »
Just how accurate (time) is accurate?