Electronics > Projects, Designs, and Technical Stuff
Need a push in the right direction for interfacing with USB Device
(1/3) > >>
LittleRain:
What I'm trying to do is read inputs from a USB Game pad(Xbox360), with a micro controller.
I need help figuring out how USB data is communicated.
I'll need to be able to initialize the device, and then of course read the data it sends.



I've hooked the game pad up to a logic analyzer, and captured the moments of plugging the device in.
I was hoping someone could help shed some light on whats happening.
Here is the data I captured.
upload picutre

In the first row, it is just plugged into a power source, it doesn't get initialized so it doesn't start sending packets.
The second row its plugged into a PC, as you can see it starts sending packets.
The third row, is the same capture as the second row, but I've added some measurements for a "bookmark". (I just realized there is minor differences between row 2 and 3, but that's only because of zoom level).

Is someone able to explain what is being sent, and how it is being sent (like which bits do what), between the "bookmarks" in the image?
Or even if I could just get a pointer to where I could begin to understand all of it. (I do understand the basics, kind of. Like how this would be an interrupt transfer type, and how this would be high speed because D+ is pulled high).
I really just need to get a good starting point.

Any help is greatly appreciated, thanks.
ataradov:
Analyzing USB using logic analyzer is going to be hard/impossible.

You either need a hardware analyzer (expensive), software analyzer (cheap/free, but possibly glitchy), or just plug it into the OS that can provide good debug info (Linux) and read the device descriptors. It may be a simple USB HID device.

If you have never worked with USB, explaining it in a forum post is pretty much impossible. USB 2.0 specification is 650 pages long. You don't need most of it, but you still need a good chunk.

Also what MCU are you using? You don't think about implementing this in software by bit-banging the USB protocol, do you?
rs20:
I'd strongly recommend starting by getting a development board that has a microcontroller on it that speaks USB directly (i.e., none of this Arduino nonsense) (a specific example might include the STM32F072B-DISCO board); and building a game pad device first. It obviously doesn't have to be fully featured, but by building a super basic "game pad" that just has a couple of buttons, exposing it as a USB HID device, and getting that working on a PC, you'll hopefully learn a whole lot of stuff that will be invaluable to deciphering whatever it is that an Xbox360 controller is doing.

I do know for a fact that Xbox360 controllers are supported on Linux, but I also vaguely remember that the Xbox360 Elite controllers were only supported quite recently, which makes it sound like they are maybe not standard USB HID controllers. But on the plus side, the source code of the Linux drivers is out there, so there's some prior art you can build off of.

EDIT: One other issue, IIRC, is that many USB-capable microcontrollers are USB-device only, and can't act as a USB-host. Another thing to watch out for when selecting a development board/MCU for your actual project.

And as ataradov pointed out; do not try to bit-bang USB.
ataradov:
Yes, that too. I strongly suspect that those controllers are well documented by now.
Geoff_S:
Jan Axlson has a great website on USB (and a book also). Suggest you start there.  And then get a USB analyser since a logic analyser is too low-level to be of much help for what you're trying to do.
http://janaxelson.com/usb.htm
Navigation
Message Index
Next page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod