The USB Protocol, Explained

If you can explain what a USB PID, a J state, a K state, and an SOF are, you can probably stop reading now. But if you don’t know or you want a refresher, you can spend 15 minutes watching [Sine Lab’s] straightforward explanation of the USB protocol details. You can find the video below.

The motivation for this is he wants to add USB to his projects using an ATMega with a hardware USB implementation. Honestly, most of the time, you’ll just consume some premade library and get it working that way. However, understanding the terminology can help you, especially if things don’t go as planned.

Of course, another useful method is to just use a canned USB “serial port” and treat the whole thing like an old-fashioned serial port. But for some things you do want to take advantage of the speed and capabilities of the USB specification.

The last few minutes of the video get to a practical example. We agree with the decision to use a library, and in this case, he uses LUFA, an open-source USB stack for the processor he wants to use. But understanding the actual protocol will help you make sense of the documentation and troubleshoot. The example uses a HID device, which is yet more protocol you’ll have to read up on separately.

If you want to learn more about USB-C, [Arya Voronova’s] got you covered. The CDC USB profile can support multiple serial ports, but if you’d rather abuse a single serial port to get multiple virtual ports, that’s possible, too.



The USB Protocol, Explained
Source: Manila Flash Report

Post a Comment

0 Comments