RE: reading data at 500Hz
Hi, Well the amount of data is very small, about 16 floats plus a header in the message. Lets round it up to 128 bytes. That means 128000 bytes per second for a 1000Hz frequency (which the device can give). 128000 bytes per second is a lot less than the 480 Mbps that USB 2 gives. That's what's killing me. That in theory I should be able to do it, but the data arrives in bursts. PD: I had hit "reply" instead of "reply to all" by mistake before. Sorry for the repeated messages. Jose Colmenares. Software Engineer. Dynamic Legged Systems, Advanced Robotics. Italian Institute of Technology. +39 010 717 818 18 From: Greg KH [g...@kroah.com] Sent: Sunday, December 06, 2015 6:39 AM To: Jose Colmenares Cc: USB list Subject: Re: reading data at 500Hz 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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
reading data at 500Hz
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. 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! 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. 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. Cheers. Jose Colmenares. Software Engineer. Dynamic Legged Systems, Advanced Robotics. Italian Institute of Technology. +39 010 717 818 18-- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
USB Device needs to be unplugged and plugged in to work
I posted this question in Stack Overflow, and somebody recommended that I post it here. I'm using an IMU (Inertial Measurement Unit) which connects via USB. I have to unplug it and plug it again to be able to use it. The IMU is used to get acceleration and positioning data (among other things). I have an example driver code from the manufacturer (I'll call it driver A), and another driver I found on github (driver B). Both have the same problem. If I plug in the device everything works. If the computer starts, and the IMU is already plugged in, I have to unplug it and plug it again. This is unacceptable because the IMU will be used in a robot, so we cannot just unplug it every time the robot starts. With driver A I get some basic information from the device like model number, but it freezes when I request data. With driver B, it just won't even start. Until, like I said, I unplug it and plug it again and then everything works. I found this code to "reset" a usb device via the OS (I'm using linux, ubuntu 14.04). When I run it dmesg gives the following output: [ 2443.165898] usb 3-1: reset full-speed USB device number 2 using xhci_hcd [ 2443.182281] xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 880036bed700 [ 2443.182290] xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 880036bed740 [ 2443.182295] xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 88003687e600 [ 2443.182310] usb 3-1: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes [ 2443.182695] cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem. [ 2443.182725] cdc_acm 3-1:1.0: ttyACM0: USB ACM device If I run lsusb, the IMU is shown. But the IMU is still not working. The blinking of the led on its cover says its in idle mode as it was before. I still have to manually unplug it and plug it again for it to work. Maybe is a power issue? Has anyone reading this have had issues like this before? This data is to be published using ROS if that is of any help. The device is a microstrain 3DM-GX4-25 IMU. EDIT: When I say I have two drivers, what I mean is that I have two programs that can read data from the device. They may not necessarily be in a "driver format". I'm going over this right now. Jose Colmenares. Software Engineer. Dynamic Legged Systems, Advanced Robotics. Italian Institute of Technology. +39 010 717 818 18-- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html