Hello I use the cy7c67200 (EZ-OTG) on a fpga (Altera DE2-115). I successfully implemented The enumeration process with help of the document "Using HPI in Coprocessor mode with OTG-Host -AN6010"
and want to read now some data from a usb flash drive.
But i have issues on that. Im not fully sure if I understand right how to do that, sadly i didnt found any examples which don't use high level frameworks and
where i can see how i send CBWs (command block wrapper) and how i receive the CSW (Command Status Wrapper).
Thats why i like to describe how i do it in the hope someone can tell me if I do it right in general .
What i do is: i issue a bulk reset.
Then i write a setup TD (Transfer Descriptor) which points with its BaseAddr to the CBW content.
CBW (on position 0x50C):
CDB: 28 00 00 00 00 00 00 00 08 00
My wMaxPacketSize as reported by the endpoint descriptor is 64 so i think I have to define the length in the CDB as 8 if i want 512bytes?
TD (at position 0x500):
Then i write a (data) TD with PID_IN and point with the BaseAddr where i want the data should be written.
TD (at 0x528)
Then i write a (status) TD which points with BaseAddr where i want to read the CSW
Then i set the CurrentTDPointer to 500 and wait until the HPI_STATUS register reports TDListDone.
Then i read the data buffer at 0x534 where I expect the content from my usb device and i read the content
from 0x740 where i expect my CSW content.
But the data contains garbage, the csw signature for example is wrong and the csw tag is not equal to the value in my cbw.
Also the data which should be the 512 bytes of the flashdrive from LBA: 0 are not identical with the contents from the flashdrive.