USBD descriptor parsing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USBD descriptor parsing

642 Views
davidtulloh
Contributor II

Hi,

I have been having a nightmare of a time trying to write a custom set of descriptors for USBD (using LPC11U24F).

Sometimes the hardware init function gives me a ERR_USBD_BAD_MEM_BUF error, sometimes it hangs, occasionally I have gotten the ERR_USBD_BAD_DESC error.

I have verified that it the common issues, memory alignment, size etc. Reading through discussion board it seems like a number of people have had similar struggles without a solid resolution.

Would it be possible to get a copy of the parser code used by the hardware init function?

I am willing to sign an NDA if required. Currently writing the full/high speed descriptors is an incredibly frustrating experience, throwing them at a black box and getting misleading errors back. Being able to step through the parsing code would make writing a working descriptor far far easier.

2 Replies

486 Views
davidtulloh
Contributor II

Responding to this to try and help anyone who digs it up.

My issue was in part caused by an incorrect length field. I believe if the length is incorrect the parser starts jumping to random memory locations causing an interesting variety of errors, trying to understand or figure out the logic behind them won't lead anywhere useful.

I solved it by stripping it back and adding one descriptor at a time. Every time you add a descriptor you need to update all the lengths including the total length and interface length. If it looks like it works double check it on a PC using lsusb, just because you don't see an error doesn't mean there isn't one, this helps prevent back tracking.

lsusb -D /dev/bus/usb/001/001

486 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

Could you provide us more detailed info about the USB application?

Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos