Hi to all.
I solved my problem with RX_ERROR. I counld not understand for a long time why does error happen. I also captured usb bus by agillent oscilloscope, but it was failure. Now I know what's the problem - enumeration procedure! I leaned usb packet dumps of MS DOS, Win XP and make typical enumeration & configuration procedures for USB Host Driver. So, as you know, enumeration procedure can be different for different OS, therefore host developer must make universal enumeration & configuration sequences for all devices.
My enumeration sequence:
1. Get Device Descriptor (18 bytes) by default address (0)
Of course, you can responce maximum bytes for EP0 (64) like MS DOS. It will be also correct request. Pay attention, some OS responce only 8 bytes at first, It is not so right, 'cause there are flashes don't like it. In any book I read standard enumeration procedure should start with Set Address. I have the usb flash which crashes by setting address at first.
2. Set Address by device registration number
You can set any address to device beside default (0) and more than 0x7F.
3. Get Configuration Descriptor (9 bytes then the whole size of transaction)
4. Get String Descriptor (option)
5. Set Configuration
You must select the number of configuration which device sends to host at config descriptor (bConfigurationValue).
6. Set Interface (option)
You have set interface only after Set Configuration, and you must select interface with bInterfaceNumber & bAlternateSetting at interface descriptor. Pay attention, this parameters must be 0! I read that some flashes crash after this request, but all versions of OS Windows select and set interface for usb msd.
And one more... if you did all that and procedure is failed on any enumeration step, it means you should give more time to flashes between enumeration steps (10-50 ms), 'cause some devices have to alive after your request.
My configuration sequence (for SCSI Bulk-Only):
1. Get Max LUN (retry 3)
This is standard class-specific request, but not all usb devices support it. You can get STALL from device or no data, so you should use Clear Feature request for EP0 Halt. If usb device didn't reply for LUNs after retry 3, it means device doesn't support this request and max lun = 0.
2. Inquiry (retry 5, 36 bytes responce size)
This is standard request for all usb scsi bulk-only device, so you have get reply on it. If you have no relpy - send Request Sense command, and send Inquiry again. There are some flashes which not support this request (you can find them at special linux header/source file). Now many usb devices (specially usb 3.0) contains more inquiry sense data. This fact is indicated by usb devices in field "additional length" of inquiry sense data.
3. Test Unit Ready (retry 10)
This is standard request for all usb scsi bulk-only device, so you have get reply on it. If you have no relpy - send Request Sense command, and send Test Unit Ready again.
4. Read Capacity (option) (retry 3)
There are some flashes which not support this request (you can find them at special linux header/source file). Also now we have many file systems which work without read capacity data, 'cause FS read boot sector & MBR by itself.
Thanx Jan. From russia with love)