Using SerialUSB to test the usb speed.
// -- USB speed test --
unsigned char buffer[64];
void loop()
{
SerialUSB.write(bufffer, 64);
}
//---------------------
I only got a 32kB/s transfer rate. :-(
Looked into the code and found this:
usb_cdcacm.c:
--------------
...
#define VCOM_TX_EPSIZE 0x40
...
// We can only put VCOM_TX_EPSIZE bytes in the buffer
/* FIXME then why are we only copying half as many? */
if (len > VCOM_TX_EPSIZE / 2) {
if (len > VCOM_TX_EPSIZE / 2;
}
...
------------------------------------
Changed to: if (len > VCOM_TX_EPSIZE) len = VCOM_TX_EPSIZE;
And now with the same test i get 700 kB/s. :-)
Changing the VCOM_TX_EPSIZE to 0x20 also works.
this results in 600 kB/s.
Doing two calls of 32 bytes doesn't work, only 32 kb/s.
SerialUSB.write(bufffer, 32);
SerialUSB.write(bufffer, 32);
It seems that only when the buffer is filled completely to the VCOM_TX_EPSIZE in
one go you get the high transfer speed.
I am no usb expert but i think when the buffer is completely filled in one go
it allows to send multiple packets per usb frame.