Quote from: technix on September 25, 2016, 08:28:31 AMI tried to read the USB protocol manuals but those documents are more like a barrier
Well, yes. Backward compatibility over three versions, 4 speed ranges, several data "classes", and mixed in licensing and trademarking issues, all written by a massive committee. I have no doubt that the official documents are pretty close to incomprehensible.
Someone has already suggested Jan Axelson's book. It's pretty good. There is also this free "book" from FTDI:
http://www.ftdichip.com/Support/Documents/TechnicalPublications/USBDesignByExample.htmLUFA is probably a good example. Originally written for Atmel AVRs, my understanding is that NXP hired the LUFA developer to do their USB libraries, so they are also LUFA-like. LUFA has pretty favorable licensing terms; it would be a good starting point. I don't think that you should consider bit-banging USB (ala VUSB); that's a whole different set of problems.
(Take the following with a grain of salt. I haven't actually written and USB code; though I have read the books and READ some USB code.)
A simple USB driver shouldn't be TOO awful to write. For your simple case, it might not be any more difficult to write than it is to understand vendor libraries that were written to be able to support much more complicated scenarios. USB reminds me a lot of other networking protocols and their attempts to establish communications with "zero configuration" - so USB enumeration is a lot like TCP/IP DHCP or the old ARPANet NCP/ICP mechanism: "how do I establish a data communications path based on a bunch of internal information that is NOT a HW addressable entity?"
There are essentially two phases of USB communications:
1) "Enumeration" - the USB device sends a bunch of information to the USB Host telling it what kind of device(s) it is, what kind of data it is going to send, and the host uses that info to pick a driver. (Writing a USB stack for a host would be much more complicated, BTW.) For simple devices, you'll want to piggyback on one of the existing device types like HID (mouse/keyboard) or CDC/ACM (Modem. Of which "COM Port" is a subset), because otherwise you'll have to write host side drivers as well...
2) Data transfer. This is relatively traditional, except that data is packetized, and packet transmission is likely to take place annoyingly asynchronously to the actual microcontroller application. Should be easy if you have small amounts of data and don't care too much about performance. But it will require an understanding of interrupts and an appreciation of concurrency issues.