USBD descriptor parsing

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

USBD descriptor parsing

886 次查看
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 回复数

730 次查看
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

730 次查看
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 项奖励
回复