USB interfacing in MATLAB

12 visualizaciones (últimos 30 días)
Rajat Garg
Rajat Garg el 24 de Jun. de 2016
Comentada: Walter Roberson el 24 de Jun. de 2016
Hello, I'm new to matlab. I'm working with one algorithm which requires the data from peripherals (USB interface). I want to read and analyze this data coming from the peripheral directly in MATLAB. so, is there any way to do this? I can connect the USB and use serial command in matlab but I still dont know how will it work?

Respuestas (2)

KSSV
KSSV el 24 de Jun. de 2016
You can read the data available in USB directly into MATLAB. You have to mention the the path of USB and load data. Loading data depends on in what format your data is in. Read about cd,path, pwd,dir, what in MATLAB. This will help you to understand how to change folders in MATLAB.
  4 comentarios
Rajat Garg
Rajat Garg el 24 de Jun. de 2016
With gaming consoles, I mean the gamepad (USB interface, use to play games in PC without keyboard or mouse). Also some gaming consoles can be some steering console (for racing games).

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 24 de Jun. de 2016
USB does not just send "data". USB is a complete protocol, in some ways more complicated than TCP/IP. Even if you just want the data payload, there are different kinds of data payload.
"Isochronous transfers occur continuously and periodically. They typically contain time sensitive information, such as an audio or video stream." (these are sort of like UDP, in that packets with errors will be dropped)
"Bulk transfers can be used for large bursty data. Such examples could include a print-job sent to a printer or an image generated from a scanner." (these are sort of like TCP in that error detection will take place and data will be resent if needed)
There are also Control and Interrupt interfaces.
Then as you can see on the next page of that site, http://www.beyondlogic.org/usbnutshell/usb5.shtml, any USB device can have different interface descriptors. With devices such as a Kinect that have multiple functions, each of those interfaces would be handled independently. Some of them could be isochronous and some of them could be bulk, and because the isochronous ones have priority, data for one interface might have to queue up instead of being transmitted when it is available. You therefore need to monitor not just data but interface identifier.
That particular site only describes low speed and full speed; matters get more complicated for high speed. See http://www.usbmadesimple.co.uk/ums_7.htm . Now you can get multiple transactions per microframe, and now you can get "split" transactions, which has to do with dealing with multiple speeds of devices on a single USB bus. And even that site is only USB 2, not USB 3 and certainly not USB 3.1 .
You might want to set up a USB Sniffer

Categorías

Más información sobre Board games en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by