SanderR wrote:
I did now read the descriptor and this is showing that bulk in and bulk out on real hardware are on ep1 and on the emulator on ep1 and ep2.
This is a great example of why you have to read in the EndPoint Descriptors and write your driver to allow different numbers and directions on these numbers.
Your actual hardware is using the same number for both IN and OUT (which is perfectly legal), yet the emulator uses two different numbers, one for IN and one for OUT.
SanderR wrote:
I just do not understand why I need to chunk it down into pieces of 144 in the emulator and 512 on real hardware. I do not see where this is defined.
You don't. There is clearly a mistake somewhere. The value of 144 is not a valid transfer length, unless it is the last packet and then not likely. What I would look at is the MaxPacket field of the Endpoint Descriptor. The emulator might have it as 512 (for a super speed device) yet the real hardware may have it a different size, maybe 256 or even 64, though 512 would be likely.
Also, since you are using the xHCI, you will need to make sure you have set up your CONTEXTs correctly to mirror the endpoint values. The CONTEXT max packet size must match the endpoint max packet size, etc.
SanderR wrote:
I wrote a CommandBlockWrapper of 31 bytes and put me command inside there.
On the emulators it runs perfectly and I can run more then 1 command and after recieving each command I wait for the CommandStatusWrapper.
On real hardware I can only run it once and after sending the CommandBlockWrapper I get right away the CommandStatusWrapper followed by data which is partly hidden by the CommandStatusWrapper. After trying to send the next command or when Im trying to get the rest of the data, my system issues a timeout after waiting for 5 seconds.
I do not understand this behavour
I don't understand it either. If you are receiving the CSW just after sending the command, you most likely have an error in your CBW.
Check the command you are sending. Different BBB devices will either use the RBC (Reduced Block Command) commands, actual SCSI commands, MMC5 commands (usually a CDROM), as well as a few other variants. The Device Descriptors will tell you which Command Set you can use for this device.
After determining the Command Set, a Super-Speed Thumb Drive then might use UAS or BBB transport. A Full- or High-speed device will use BBB, with some High-speed devices using UAS.
USB is far from simple. It takes a lot of work and a lot of reading to get all of it. I still have issues with my code on some machines using some devices and I have been at it for 20+ years. :-)
Good luck,
Ben
Edit: I need to read the subject lines more often. I was still in your xHCI thread and not thinking I was in your EHCI thread. Sorry about that. Anyway, most of the above still is valid for EHCI.