This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x : gadgetfs hanging after a while

Hi, 

  I try to transfert a file over gadgetfs and it's hanging after a while... seems to be no IRQ generated in the middle of the transfer.  it blocks on a read() sys call when I sould get something.  The same Windows host application works with Mentor Nucleus on the target.

NOTE : I have a XAM3352 Rev 1.0

From USBlyzer on the host I get : USBD_STATUS_XACT_ERROR

debug traces on the linux target :

Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658765] musb-hdrc musb-hdrc.0.auto: <== RX/OUT request c30ca300 len 512 on hw_ep2
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658778] musb-hdrc musb-hdrc.0.auto: ep2out OUT/RX pio fifo 512/512, maxpacket 512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658791] musb-hdrc musb-hdrc.0.auto: RX ep2 fifo c898c428 count 512 buf c42bee00
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658835] musb-hdrc musb-hdrc.0.auto: ep2out done request c30ca300, 512/512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658844] gadgetfs: ep2out read 512 OUT, status 512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658860] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0000 tx0000 rx0004
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658886] musb-hdrc musb-hdrc.0.auto: <== to ep2out request=c30ca300
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658899] musb-hdrc musb-hdrc.0.auto: <== RX/OUT request c30ca300 len 512 on hw_ep2
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658912] musb-hdrc musb-hdrc.0.auto: ep2out OUT/RX pio fifo 512/512, maxpacket 512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658925] musb-hdrc musb-hdrc.0.auto: RX ep2 fifo c898c428 count 512 buf c42bee00
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658969] musb-hdrc musb-hdrc.0.auto: ep2out done request c30ca300, 512/512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.658979] gadgetfs: ep2out read 512 OUT, status 512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659003] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0000 tx0000 rx0004
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659019] musb-hdrc musb-hdrc.0.auto: <== to ep2out request=c30ca300
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659032] musb-hdrc musb-hdrc.0.auto: <== RX/OUT request c30ca300 len 512 on hw_ep2
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659045] musb-hdrc musb-hdrc.0.auto: ep2out OUT/RX pio fifo 512/512, maxpacket 512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659057] musb-hdrc musb-hdrc.0.auto: RX ep2 fifo c898c428 count 512 buf c42bee00
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659101] musb-hdrc musb-hdrc.0.auto: ep2out done request c30ca300, 512/512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659111] gadgetfs: ep2out read 512 OUT, status 512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659134] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0000 tx0000 rx0004
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659175] musb-hdrc musb-hdrc.0.auto: <== to ep2out request=c30ca300
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659189] musb-hdrc musb-hdrc.0.auto: <== RX/OUT request c30ca300 len 512 on hw_ep2
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659201] musb-hdrc musb-hdrc.0.auto: ep2out OUT/RX pio fifo 512/512, maxpacket 512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659214] musb-hdrc musb-hdrc.0.auto: RX ep2 fifo c898c428 count 512 buf c42bee00
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659258] musb-hdrc musb-hdrc.0.auto: ep2out done request c30ca300, 512/512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659267] gadgetfs: ep2out read 512 OUT, status 512
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659289] musb-hdrc musb-hdrc.0.auto: <== to ep2out request=c30ca300
Feb 11 22:02:20 am335x-evm user.debug kernel: [ 90.659302] musb-hdrc musb-hdrc.0.auto: <== RX/OUT request c30ca300 len 512 on hw_ep2

Linux code (the logic behind it) :

M_FileDescriptor = open(filename, O_RDWR);

...

while (1)

{

   BytesToProcess = read(M_FileDescriptor, Buffer, BufferSize);

   PutInCircularBuffer(Buffer, BytesToProcess);

}