We have our custom BF547M-based board and we are trying to work with USB flash drives.
We have some drives that works well, but also we have some drives with problems.
One of such problematic drives is Transcend JetFlash 4Gb TS4GJF2A. An old and fast one.
After insertion to USB and calling adi_Poll_Media() program hangs.
After debugging, I've noticed the difference between working drives and problematic drives.
During initialization, GetMaxLun function is called and following command is sent over USB. With working drive we got interrupt with "received packet" flag. With problematic JetFlash interrupt comes, but it comes with another flag installed - "EP is stalled". And after that initialization hangs.
I've looked to mass storage specification and here is what I found:
On Get Max LUN:
"The device shall return one byte of data that contains the maximum LUN supported by the device. For example,
if the device supports four LUNs then the LUNs would be numbered from 0 to 3 and the return value would be
3. If no LUN is associated with the device, the value returned shall be 0. The host shall not send a command
block wrapper (CBW) to a non-existing LUN.
Devices that do not support multiple LUNs may STALL this command."
So, it appears that such behavior(I mean STALL of EP) is matching standard.
Can you, please clarify this situation?