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
How to use Bulk Transfer in Delphi
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.
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.
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.
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.
OK
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
usbFunctionSetup(uchar data[8])
and Return 128 , usbMsgPtr = Pointter of My data
Please recommend me
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
usbFunctionSetup(uchar data[8])
and Return 128 , usbMsgPtr = Pointter of My data
Please recommend me