cancel
Showing results for 
Search instead for 
Did you mean: 

HID Report Descriptor Contains Wrong Byte

jvavra
Associate III
Posted on April 09, 2014 at 14:45

I've got a USB HID device based on a STM32F427 that can be set up to run as either FS or HS USB. When I use FS, all is well. However, when I use HS (which uses the same descriptor), the report descriptor contains one extra byte when I view the USB traffic using my analyzer: a 0x00 as the first byte of the descriptor. The rest of the descriptor is 100% correct, except shifted right by that one byte. Since the report size is fixed, this causes me to lose a byte off the back end of the descriptor report, which then results in the host setting the device to unconfigured.

I have stepped through where the descriptor is sent, and the pointer to the report buffer is correct all of the way through transmitting the data over USB via the ST library function DCD_EP_Tx. I have verified that my report is correct, and located at that address. My only clue is that when I view the Memory contents in my IDE at the starting address of the descriptor, I do have a 0x00 located just before the start of my descriptor. However, as the pointer is always correct, it's not clear to me how this ''extra'' byte is getting transmitted, or if the previous memory location is indeed the source of this extra byte.

Anyone have any thoughts?

#stm32-usb-device
2 REPLIES 2
jvavra
Associate III
Posted on April 09, 2014 at 17:23

One thought: the address for the buffer holding the report descriptor is 0x080044B9, which is not an a integer/word boundary. Is it possible this is causing the DMA to pick up this extra 0x00 byte located just before? Any easy way anyone can think of to test for this?

Thanks

jvavra
Associate III
Posted on April 09, 2014 at 18:42

I see it now, from the comments in usb_conf.h:

/* In HS mode and when the DMA is used, all variables and data structures dealing

   with the DMA during the transaction process should be 4-bytes aligned */

Need to be sure my config data is 4-byte aligned.