manitou
Senior Member+
FWIW, in https://www.pjrc.com/teensy/usb_serial.html there was a USBsend sketch and host receiver (serial_listen.c or serial_read.c). For T3.6 it reports 1152.09 kbytes/sec to linux host with USB hub and 1152.11 kbytes/sec for T3.2. For T4B2 (latest github no debug printf's) it reports 7729.36 kbytes/sec -- a bit too fast me thinks, so maybe it's not a valid benchmark.
EDIT:
win10x64 + USB hub: T3.6 870.32 KBs, T4B2 1197.95 KBs
macos: T3.6 1168.07 KBs, T4B2 6209.18 KBs
Code:
// https://forum.pjrc.com/threads/29078-USB-Transmission-speed
// https://www.pjrc.com/teensy/usb_serial.html
// USB Serial Transmit Bandwidth Test
// Written by Paul Stoffregen, paul@pjrc.com
// This benchmark code is in the public domain.
//
// Within 5 seconds of opening the port, this program
// will send a message as rapidly as possible, for 10 seconds.
//
// To run this benchmark test, use serial_read.exe (Windows) or
// serial_listen (Mac, Linux) program can read the data efficiently
// without saving it.
// http://www.pjrc.com/teensy/serial_listen.c
// http://www.pjrc.com/teensy/serial_read.c
// http://www.pjrc.com/teensy/serial_read.exe
//
// You can also run a terminal emulator and select the option
// to capture all text to a file. However, some terminal emulators
// may limit the speed, depending upon how they update the screen
// and how efficiently their code processes the imcoming data. The
// Arduino Serial Monitor is particularly slow. Only use it to
// verify this sketch works. For actual benchmarks, use the
// efficient receive tests above.
//
// Full disclosure: Paul is the author of Teensyduino.
//
// Results can vary depending on the number of other USB devices
// connected. For fastest results, disconnect all others.
#define USBSERIAL Serial // for Leonardo, Teensy, Fubarino
//#define USBSERIAL SerialUSB // for Due, Maple
void setup()
{
USBSERIAL.begin(115200);
}
void loop()
{
// wait for serial port to be opened
while (!USBSERIAL) ;
// give the user 5 seconds to enable text capture in their
// terminal emulator, or do whatever to get ready
for (int n=5; n; n--) {
USBSERIAL.print("10 second speed test begins in ");
USBSERIAL.print(n);
USBSERIAL.println(" seconds.");
if (!USBSERIAL) break;
delay(1000);
}
// send a string as fast as possible, for 10 seconds
unsigned long beginMillis = millis();
do {
USBSERIAL.print("USB Fast Serial Transmit Bandwidth Test, capture this text.\r\n");
} while (millis() - beginMillis < 10000);
USBSERIAL.println("done!");
// after the test, wait forever doing nothing,
// well, at least until the terminal emulator quits
while (USBSERIAL) ;
}
EDIT:
win10x64 + USB hub: T3.6 870.32 KBs, T4B2 1197.95 KBs
macos: T3.6 1168.07 KBs, T4B2 6209.18 KBs
Last edited: