Author Topic: USB Enumeration  (Read 11117 times)

Ray

  • Member
  • ***
  • Posts: 13
USB Enumeration
« on: August 18, 2011, 06:25:34 pm »
I have finally managed to get my PC to talk to the Microchip PIC18F4550. I have opted to code entirely in Assembler so that I fully understand what is going on under to hood.

My question relates to the enumeration process, and specifically with regards to retrieving the Configuration Descriptor.

In the book USB Complete - 2nd Edition, the process is described as retrieving the first 9 bytes of the configuration descriptor, then retrieving up to FFh bytes.

In the 4th edition extract on the website it describes the second grab as only retrieving the number of bytes designated in the descriptor.

In my case, I have found the following:
9 bytes requested, 9 bytes returned by my firmware
255 bytes requested, 34 bytes returned (as this is the size of all my relevant descriptors)
The it starts again:
9 bytes requested, 9 bytes returned by my firmware
34 bytes requested, 34 bytes returned by my firmware.

It would appear that my PC has read both of the editions of your book and is now confused as to which to implement, and opted to implement both.

Is this normal?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB Enumeration
« Reply #1 on: August 18, 2011, 08:46:26 pm »
>It would appear that my PC has read both of the editions of your book and is now confused as to which to implement, and opted to implement both.

;)

The editions actually don't contradict each other, "up to 255" can mean 34.

The host can do whatever it wants. The device should just respond to the host without trying to figure out why. Sometimes multiple drivers will request a descriptor. But if you're seeing what you described one after the other, it's possible that something didn't look right to the host the first time around.

Jan