How fast is Software-USB
sorry, but i have one more question:
how many bytes i transfer with:
and how many bytes with:
my initialisation for result is:
how many bytes i transfer with:
Code: Select all
unsigned char iodata[8];
if ((result = sendUSBVendorCmdIn( avr_speed, 0, 0, iodata, 1)) < 0)
{
printf("Fehler!\r\n");
return -1;
}
and how many bytes with:
Code: Select all
unsigned char iodata[8];
if ((result = sendUSBVendorCmdIn( avr_speed, 0, 0, iodata, 2)) < 0)
{
printf("Fehler!\r\n");
return -1;
}
my initialisation for result is:
Code: Select all
int sendUSBVendorCmdOut(int request, int value, int index, void *replydata, int len)
{
int result;
result = usb_control_msg(usbIODevice, // USB Device Pointer
USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, // USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER
request, // request see USB documentation
value, // value see USB documentation
index, // index see USB documentation
replydata, // buffer for the replay data
len, // len of the replay buffer
1000); // timeout in ms
return result;
}
If your sendUSBVendorCmdIn() is defined analogous to sendUSBVendorCmdOut(), you receive one byte in the first case and two in the second. Please note that you actually transfer many more bytes, that's the overhead of control transfers.
For efficient transfers, send or receive at least 100 bytes (if possible) in each call to usb_control_msg().
For efficient transfers, send or receive at least 100 bytes (if possible) in each call to usb_control_msg().
so if i send to the controller
with
i transfer 100 byte? or is this wrong?
Code: Select all
if ((result = sendUSBVendorCmdIn( avr_speed, 0, 0, iodata, 100)) < 0)
{
printf("Fehler!\r\n");
return -1;
}
with
Code: Select all
unsigned char iodata[100];
i transfer 100 byte? or is this wrong?
Since your function name is sendUSBVendorCmdIn(), I guess you transfer 100 bytes from the device to the host. In and Out are defined from the host's point of view.
But you are right, this should transfer 100 bytes unless an error occurs. A possible error would be that the host and the device don't agree on the transfer size.
But you are right, this should transfer 100 bytes unless an error occurs. A possible error would be that the host and the device don't agree on the transfer size.
This limit is not in the USB spec and it would be possible to extend AVR-USB for bigger message sizes. However, since this requires 16 bit arithmetics, it would bloat the driver size. Another #ifdef would make it harder to maintain.
We have done some transfer speed measurements and found that increasing the message size even further does not improve speed, at least not considerably. A good reason for a 16 bit size would be a USB descriptor (e.g. HID) bigger than 254 bytes, but that was not a problem so far.
We have done some transfer speed measurements and found that increasing the message size even further does not improve speed, at least not considerably. A good reason for a 16 bit size would be a USB descriptor (e.g. HID) bigger than 254 bytes, but that was not a problem so far.