Home arrow Support arrow Forums

Luminary Micro Forums

totenhose

Senior Boarder

2008/08/16 06:20

Bug in usblib?

I'm having complications receiving data from USB host Bulk IN pipe. While doing that i noticed a bit odd code in usblib/usbhostenum.c file. There's this line:

#define EP_PIPE_HANDLE(ulIdx) (g_sUSBHCD.USBOUTPipes[ulIdx].ulType | ulIdx)

It is written for OUT pipes but EP_PIPE_HANDLE is used in USBHostIntHandlerInternal function also with IN pipes. Therefore the callback gives OUT pipe handles, instead of IN ones.

login or register to reply

totenhose

Senior Boarder

2008/08/17 18:32

Re:Bug in usblib?

This is not related to the bug thing, but i think it will help others with writing USB host class drivers:

After a week of painful testing i found the cause of problem of not getting data from device. It is only possible to read 64 bytes of data with USBHCDPipeRead function from Bulk IN pipe configured in DMA mode. If i give the length parameter under 64 i won't get no data. I tried non-blocking read and non-DMA mode also but they didn't work either. As i examined usblib/host/usbhostenum.c file i noticed hard-coded 64 byte FIFO buffer sizes and in one comment there's:
"The uDMA transfers must match the USB FIFO size when with Rev A0 silicon."

There's no word about it in datasheet nor library reference and this really rules... not. It should be pointed out clearly. Although i wonder how the MSC driver works as there are some read function of less than 64 bytes, i am not interested in further examinations. Maybe someone with more experience can explain it.

PS.
I use EK-LM3S3748 and write PTP host driver.

login or register to reply

totenhose

Senior Boarder

2008/08/17 18:32

Re:Bug in usblib?



Post edited by: totenhose, at: 2008/08/17 18:32

login or register to reply