Re: reading data at 500Hz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 04, 2015 at 12:46:14PM +0000, Jose Colmenares wrote:
> Hi,
> 
> I'm using a USB Inertial Measurement Unit that theoretically produces
> data at 500Hz. According to the timestamps on the data, indeed the
> data is being produced at 500Hz. But I'm getting it in burst, with an
> "efective" sampling rate of 6ms instead of 2ms. That is, 166Hz instead
> of 500hz.
> 
> I'm running ubuntu 14.04. I tried modifying the priority of the
> thread, but nothing changed.

What thread?

> The data is being read in polling mode. Every 2ms I try to read data
> from /dev/ttyACM0. A previous implementation was using the ioctl
> library to get the available data size, and after reaching a certain
> value the data was read. That code was going at 10Hz... 
> 
> I'm been trying to get my head around the polling rate of the usb
> driver, but all I find is related to USB's mouse polling rate. So I'm
> not sure how to apply that in my case. But it encourage me look
> further because it means that there may be a default usb polling rate
> somewhere!

The USB device will tell the host how often it wants to have the data
pulled from it in it's USB descriptors.  You can't increase this faster
than what the device itself is asking for.

> We are using USB 2.0 (if it matters), ubuntu 14.04, I'm reading at
> 166Hz using a standard file descriptor. But I need to get the data
> faster. 500Hz would be amazing. 250Hz ( 4ms polling rate) would be
> enough.

Are you sure that your device really can provide the data this fast over
a USB connection?  I don't think the math really adds up, look at the
speed of the USB link then take half of that for the "real" data that
can be sent from the device, and I think that's not fast enough for what
you are expecting here.

> The computer that will use the device (but I don't have access to all
> the time) has xenomai. Meaning very close to real time. But usually IO
> operations break the real time so this runs on a separate thread. I
> say this just in case is help full.

USB is anything but real-time, sorry.  If you need real-time data rates,
use something that has a chance to be deterministic, USB is not that
protocol, it's almost impossible to do due to the hardware involved.

sorry,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux