First off, I spent 1/2 a day searching for an answer to this through forums, FAQs, erratas and just plain google and I could not find an answer. I am however new to the at91 and if this has been covered somewhere I do apologise.
I am using the Adeno Win CE BSP for the AT91SAM9G20-EK and I am having an issue when I try and utilise the board as a Mass Storage Device.
The problem I am seeing is that I am getting an interrupt on Endpoint 0 (UDP_ISR bit 0 is set) signalling that Setup data was received (UDP_CSR0 bit 2 is set) but the length is 0 (UDP_CSR0 bits 16 - 23 are all clear).
The sequence of events that lead up to this is:
- Enumeration takes place and is successful.
- The host issues a 'Read Format Capacities' command to endpoint 2. (This is a Mass Storage command)
- The device acknowledges the command and sets the FORCE STALL bit of both the in and out bulk transfer endpoints (UDP_CSR1 bit 5 and UDP_CSR2 bit 5 are both set) so that the device responds with a stall packet. (Everything to here is as it should be and all is swell)
- The host then issues a 'Clear Feature - Halt Endpoint' request on endpoint 0. (A standard flash drive gets to this point, acknowledges this and continues happily)
- The device receives the interrupt on Endpoint 0 with the rxsetup bit set but data length is 0. (This is the problem!)
- The device stalls Endpoint 0.
The device does eventually recover from this, but it adds a considerable delay to the mounting of the Mass Storage Device.
I can see on my USB protocol analyser (which is a proper hardware based protocol analyser) that the host is sending the correct 8 bytes for the 'Clear Feature - Halt Endpoint' request on endpoint 0 and the device is responding with a stall on Endpoint 0.
If I ignore the length and read out 8 bytes, the data from the UDP_FDR0 register is rubbish.