Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #10839
| From | Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs |
| Date | 2012-12-17 13:27 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <kan6kp$1ai$1@dont-email.me> (permalink) |
| References | (7 earlier) <r4umc8llpcd5cq2vcrooujnuqat3mrjgf0@4ax.com> <86ehiqnlkm.fsf@gray.siamics.net> <jpesc85i0npsc7q1cp9blq5c6b57clfbm2@4ax.com> <kalqe1$8ag$1@dont-email.me> <vvtsc8lrvhfkup7ff25fksbqa441220hbr@4ax.com> |
On 2012-12-16, Jon Kirwan <jonk@infinitefactors.org> wrote: > > I think I may like to discuss this subject at more length, > sometime soon. I'm actually interested in the details (data > structures that must be used, what they are filled with, the > order of communications, etc.) > Assuming I have the time available when you want to discuss this, I don't have a problem with this. However, I think the discussion should be in comp.arch.embedded because it could benefit others as well. Another advantage would be that any opinions or comments I have would also be reviewable by others here. > I'm currently fairly ignorant, excect from glancing through > the 1000 page USB 2.0 spec -- which to my reading does not do > any tutorials on the actual data structures that a slave > device must use, nor much detail on the Windows drivers (or > Linux, freeBSD, etc) side. I know there is code out there to > read, but I'd like to get an overview of subsets, one at a > time, to consider and then master before moving on. Mostly, > it seems an all-or-nothing approach in the USB 2.0 manual -- > which makes taking the time quite daunting to start out. And > I consider Jan Axelrod's book almost useless, as well. > Don't focus on the size of the USB 2.0 spec; you only have to read a few chapters of it in order to implement a USB device stack as the spec covers physical specifications as well as hub/host requirements. You don't need to read much of that in order to implement a device only stack. I found I spent the vast majority of my time in Chapters 8 and 9 along with some dipping into Chapter 5. However, I already knew much of what is in Chapter 5 when I started, so you may spend more time there than I did. I also very strongly recommend you start out with a full speed device instead of a high speed one. This means you can ignore the high speed specific parts of the protocol until later. Your jumping on point for following the USB protocol at data structure level is the SETUP packet which your device will receive from the host as part of any operation on the control endpoint (endpoint 0). This is in table 9.2 of section 9.3. Look at this table while reading 8.5.3 (Control Transfers) which shows how this packet fits into the scheme of things. Higher level protocols (such as the CDC layer) have their own data structures and are documented in their own specifications. When you plug your USB device into the host, the USB device controller will be reset. When you have enabled endpoint 0 and have come out of reset, the next thing which will happen is that you will receive a SETUP packet from the host on endpoint 0. Your control endpoint logic is geared around interpreting these requests and responding to them as required. One of these requests will be for the device descriptor which, along with the configuration/interface/endpoint descriptors, describes your device's capabilities. I recommend you start out by making the device descriptor a vendor specific descriptor (table 9.8, bDeviceClass = 0xff) so that the host does not recognise it. In this way you don't have to worry about higher level protocols throwing requests at your device stack (at least on Linux, I don't know about Windows), but you will still go through the process of been asked for your descriptors, been assigned a address by the host and been told which configuration to use. This will allow you to start out by developing and testing the lower levels of the USB stack without having to worry about the higher level function layers just yet. Be warned however, that if you want to write a USB device stack, there will be a lot of work involved in understanding the details. Given the multiple layers to the protocol as well as it's scope, this cannot be avoided. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
baud rate autodetection on AVR 8-bit? Ivan Shmakov <oneingray@gmail.com> - 2012-12-07 21:17 +0700
Re: baud rate autodetection on AVR 8-bit? Rich Webb <bbew.ar@mapson.nozirev.ten> - 2012-12-07 10:28 -0500
Re: baud rate autodetection on AVR 8-bit? Ivan Shmakov <oneingray@gmail.com> - 2012-12-07 23:31 +0700
Re: baud rate autodetection on AVR 8-bit? Rich Webb <bbew.ar@mapson.nozirev.ten> - 2012-12-07 12:42 -0500
Re: baud rate autodetection on AVR 8-bit? mike <ham789@netzero.net> - 2012-12-07 13:35 -0800
Re: baud rate autodetection on AVR 8-bit? Rich Webb <bbew.ar@mapson.nozirev.ten> - 2012-12-07 20:07 -0500
Re: baud rate autodetection on AVR 8-bit? Mark Borgerson <mborgerson@comcast.net> - 2012-12-07 23:43 -0800
Re: baud rate autodetection on AVR 8-bit? Tim Wescott <tim@seemywebsite.com> - 2012-12-07 13:07 -0600
Re: baud rate autodetection on AVR 8-bit? Dave Nadler <drn@nadler.com> - 2012-12-07 12:09 -0800
Re: baud rate autodetection on AVR 8-bit? Ivan Shmakov <oneingray@gmail.com> - 2012-12-08 03:47 +0700
Re: baud rate autodetection on AVR 8-bit? MK <mk@nospam.co.uk> - 2012-12-08 09:44 +0000
8-bit vs. 32-bit MCU's Ivan Shmakov <oneingray@gmail.com> - 2012-12-08 18:31 +0700
Re: 8-bit vs. 32-bit MCU's MK <mk@nospam.co.uk> - 2012-12-09 14:13 +0000
Re: 8-bit vs. 32-bit MCU's Ivan Shmakov <oneingray@gmail.com> - 2012-12-09 22:52 +0700
Re: baud rate autodetection on AVR 8-bit? upsidedown@downunder.com - 2012-12-08 15:01 +0200
Re: baud rate autodetection on AVR 8-bit? Dombo <dombo@disposable.invalid> - 2012-12-08 15:18 +0100
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] Glenn <glenn2233@gmail.com> - 2012-12-09 10:47 +0100
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-12-09 10:22 +0000
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] "Bruce Varley" <bv@NoSpam.com> - 2012-12-09 19:07 +0800
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] Paul <paul@pcserviceselectronics.co.uk> - 2012-12-09 13:27 +0000
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-12-09 16:19 +0100
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] "TTman" <pcw1.cad@ntlworld.com> - 2012-12-09 15:38 +0000
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] amdyer@gmail.com - 2012-12-09 07:45 -0800
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] upsidedown@downunder.com - 2012-12-09 17:45 +0200
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] Paul <paul@pcserviceselectronics.co.uk> - 2012-12-09 21:30 +0000
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] John Larkin <jjlarkin@highNOTlandTHIStechnologyPART.com> - 2012-12-09 09:02 -0800
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] Lanarcam <lanarcam1@yahoo.fr> - 2012-12-09 18:13 +0100
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] upsidedown@downunder.com - 2012-12-09 19:44 +0200
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] Paul <paul@pcserviceselectronics.co.uk> - 2012-12-09 21:32 +0000
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] Robert Wessel <robertwessel2@yahoo.com> - 2012-12-10 00:35 -0600
Re: baud rate autodetection on AVR 8-bit? [ User friendly RS-232/EIA-232 ? ] josephkk <joseph_barrett@sbcglobal.net> - 2012-12-12 20:30 -0800
Re: baud rate autodetection on AVR 8-bit? "Meindert Sprang" <ms@NOJUNKcustomORSPAMware.nl> - 2012-12-10 13:38 +0100
Re: baud rate autodetection on AVR 8-bit? Ivan Shmakov <oneingray@gmail.com> - 2012-12-10 20:19 +0700
Re: baud rate autodetection on AVR 8-bit? "Meindert Sprang" <ms@NOJUNKcustomORSPAMware.nl> - 2012-12-10 16:24 +0100
Re: baud rate autodetection on AVR 8-bit? Arlet Ottens <usenet+5@c-scape.nl> - 2012-12-10 16:49 +0100
Re: baud rate autodetection on AVR 8-bit? Rich Webb <bbew.ar@mapson.nozirev.ten> - 2012-12-12 08:50 -0500
Re: baud rate autodetection on AVR 8-bit? j.m.granville@gmail.com - 2012-12-11 21:22 -0800
Re: baud rate autodetection on AVR 8-bit? Robert Wessel <robertwessel2@yahoo.com> - 2012-12-12 00:29 -0600
Re: baud rate autodetection on AVR 8-bit? Mark Borgerson <mborgerson@comcast.net> - 2012-12-11 23:43 -0800
Re: baud rate autodetection on AVR 8-bit? Robert Wessel <robertwessel2@yahoo.com> - 2012-12-12 02:38 -0600
Re: baud rate autodetection on AVR 8-bit? Mark Borgerson <mborgerson@comcast.net> - 2012-12-12 07:46 -0800
Re: baud rate autodetection on AVR 8-bit? linnix <me@linnix.info-for.us> - 2012-12-12 10:50 -0800
Re: baud rate autodetection on AVR 8-bit? Jon Kirwan <jonk@infinitefactors.org> - 2012-12-12 12:42 -0800
Re: baud rate autodetection on AVR 8-bit? Jon Kirwan <jonk@infinitefactors.org> - 2012-12-12 12:56 -0800
Re: baud rate autodetection on AVR 8-bit? upsidedown@downunder.com - 2012-12-12 23:22 +0200
Re: baud rate autodetection on AVR 8-bit? Robert Wessel <robertwessel2@yahoo.com> - 2012-12-12 15:39 -0600
Re: baud rate autodetection on AVR 8-bit? Jon Kirwan <jonk@infinitefactors.org> - 2012-12-12 15:13 -0800
Re: baud rate autodetection on AVR 8-bit? Jon Kirwan <jonk@infinitefactors.org> - 2012-12-12 15:28 -0800
Re: baud rate autodetection on AVR 8-bit? Robert Wessel <robertwessel2@yahoo.com> - 2012-12-12 18:41 -0600
Re: baud rate autodetection on AVR 8-bit? Jon Kirwan <jonk@infinitefactors.org> - 2012-12-12 17:12 -0800
Re: baud rate autodetection on AVR 8-bit? Mark Borgerson <mborgerson@comcast.net> - 2012-12-12 12:43 -0800
Communications under pressure (was Re: baud rate...) Frnak McKenney <frnak@far.from.the.madding.crowd.com> - 2012-12-13 10:25 -0600
Re: Communications under pressure (was Re: baud rate...) Robert Wessel <robertwessel2@yahoo.com> - 2012-12-13 12:34 -0600
Re: Communications under pressure (was Re: baud rate...) upsidedown@downunder.com - 2012-12-14 10:33 +0200
Re: Communications under pressure (was Re: baud rate...) Mark Borgerson <mborgerson@comcast.net> - 2012-12-14 07:43 -0800
Re: Communications under pressure (was Re: baud rate...) Mark Borgerson <mborgerson@comcast.net> - 2012-12-13 16:47 -0800
Re: Communications under pressure (was Re: baud rate...) Jon Kirwan <jonk@infinitefactors.org> - 2012-12-13 18:22 -0800
Re: Communications under pressure (was Re: baud rate...) Jon Kirwan <jonk@infinitefactors.org> - 2012-12-13 18:27 -0800
Re: Communications under pressure (was Re: baud rate...) Mark Borgerson <mborgerson@comcast.net> - 2012-12-13 23:20 -0800
Re: Communications under pressure (was Re: baud rate...) Frank Miles <fpm@u.washington.edu> - 2012-12-14 17:50 +0000
Re: Communications under pressure (was Re: baud rate...) Mark Borgerson <mborgerson@comcast.net> - 2012-12-14 14:28 -0800
serial host-to-device communication in amateur designs Ivan Shmakov <oneingray@gmail.com> - 2012-12-14 23:21 +0700
Re: serial host-to-device communication in amateur designs Rob Gaddi <rgaddi@technologyhighland.invalid> - 2012-12-14 09:18 -0800
Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-14 11:19 -0800
Re: serial host-to-device communication in amateur designs Ivan Shmakov <oneingray@gmail.com> - 2012-12-16 21:00 +0700
Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-16 13:46 -0800
USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> - 2012-12-17 00:53 +0000
Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-16 17:46 -0800
Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> - 2012-12-17 13:27 +0000
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Mel Wilson <mwilson@the-wire.com> - 2012-12-17 10:32 -0500
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs me@linnix.info-for.us - 2012-12-17 11:13 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-17 12:03 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-17 12:17 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Christopher Head <chead@is.invalid> - 2012-12-17 23:36 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-17 23:54 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> - 2012-12-18 13:06 +0000
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs j.m.granville@gmail.com - 2012-12-18 14:04 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-18 14:13 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Christopher Head <chead@is.invalid> - 2012-12-19 02:37 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> - 2012-12-19 12:59 +0000
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Rocky <RobertGush@gmail.com> - 2012-12-19 10:19 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-19 10:43 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-19 10:39 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-19 10:44 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Christopher Head <chead@is.invalid> - 2012-12-19 18:42 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-19 21:05 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> - 2012-12-20 14:13 +0000
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-20 11:58 -0800
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Waldek Hebisch <hebisch@math.uni.wroc.pl> - 2012-12-24 00:41 +0000
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Waldek Hebisch <hebisch@math.uni.wroc.pl> - 2012-12-24 15:45 +0000
Re: Writing a USB device stack, was: Re: USB CDC ACM, was: Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-24 11:40 -0800
Re: serial host-to-device communication in amateur designs Frnak McKenney <frnak@far.from.the.madding.crowd.com> - 2012-12-20 10:00 -0600
Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-20 11:54 -0800
Re: serial host-to-device communication in amateur designs Rob Gaddi <rgaddi@technologyhighland.invalid> - 2012-12-20 12:01 -0800
Re: serial host-to-device communication in amateur designs Jon Kirwan <jonk@infinitefactors.org> - 2012-12-20 12:27 -0800
Re: serial host-to-device communication in amateur designs Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> - 2012-12-14 17:53 +0000
Re: serial host-to-device communication in amateur designs Ivan Shmakov <oneingray@gmail.com> - 2012-12-15 01:26 +0700
Re: serial host-to-device communication in amateur designs Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> - 2012-12-14 19:30 +0000
Re: serial host-to-device communication in amateur designs Ivan Shmakov <oneingray@gmail.com> - 2012-12-15 11:25 +0700
Re: serial host-to-device communication in amateur designs Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> - 2012-12-17 00:29 +0000
Re: serial host-to-device communication in amateur designs me@linnix.info-for.us - 2012-12-17 11:05 -0800
Re: serial host-to-device communication in amateur designs Rich Webb <bbew.ar@mapson.nozirev.ten> - 2012-12-14 14:34 -0500
Re: serial host-to-device communication in amateur designs Paul <paul@pcserviceselectronics.co.uk> - 2012-12-14 23:25 +0000
finer pitches Ivan Shmakov <oneingray@gmail.com> - 2012-12-16 20:48 +0700
Re: serial host-to-device communication in amateur designs Mark Borgerson <mborgerson@comcast.net> - 2012-12-14 21:26 -0800
csiph-web