Page 1 of 1
How to use Bulk Transfer in Delphi
Posted: Wed Jul 18, 2007 10:32 am
I download Powerswitch in Delphi and modify to my project
It work very good
Now I want to transfer data from my device in bulk transfer
Please Help me for sample code in bulk transfer
Thanks Christian,iphi and Yvo
Posted: Thu Jul 19, 2007 9:51 pm
I have no idea about Delphi and how to use USB from there, but if you don't have very good reasons to use bulk transfers, I would recommend against them.
Bulk transfers are not allowed for low speed USB devices, but they are tolerated by Windows and most other operating systems. If you specify a bulk endpoint in your descriptor, the host polls aggressively, consuming 90% of the AVR's CPU time. This is probably not what you want.
If you have a choice, I would recommend that you send/receive your data in control transfers.
Posted: Fri Jul 20, 2007 6:07 am
I want to transfer from my data 1 Mbyte to Host
How I can fast Transfer Please Help me for Guide line Idea or C-code
Posted: Fri Jul 20, 2007 9:56 am
1 MB is quite a bit of data for a low speed device. You must expect a total transfer time of ~ 2 minutes.
I would recommend that you divide the data into chunks of 128 bytes (the driver allows up to 254, but you probably want a power of 2) and read these chunks with a control transfer. You can use the wIndex field of the request to address the chunk, unless it's a data stream anyway.
Posted: Fri Jul 20, 2007 4:34 pm
But I don't sure understand all right
In Application I use
usb_control_msg(udev, (USB_TVENDOR or USB_RDEVICE or USB_EP_IN), CMD_GET, 0, 0, buffer, sizeof(buffer), 5000);
to send control transfer by CMD_GET = My request , buffer = In Data , sizeof(buffer) = byte received
In Device I use
and Return 128 , usbMsgPtr = Pointter of My data
Please recommend me
Posted: Fri Jul 20, 2007 6:45 pm
That looks OK to me. You may want to pass an index and a value after CMD_GET to further identify the block, but you don't need to.
If you don't want to spend the extra 128 bytes of RAM for the reply message, you can return -1 and have usbFunctionRead() called to obtain chunks of 8 bytes each.
Posted: Fri Jul 20, 2007 7:39 pm
Thank a lot for your help