Go Down

Topic: SerialUSB.begin(0) -- really impressed f measued native USB speed (Read 2140 times) previous topic - next topic

HermannSW

Although I have several DUEs I was never able to use the native USB port :-(

Today I tried with a laptop where I installed Arduino IDE recently, and there the native USB port showed up! I was really impressed about the sketch upload speed, no comparison to speed of USB programming port.

I read somewhere that SerialUSB.begin() speed for native USB port has no meaning and even 0 can be used. I used this simple sketch to determine USB write speed to laptop (old Thinkpad T42 with 32bit Linux):
Code: [Select]
int i=0;
long t;

void setup() {
   SerialUSB.begin(0);
   while(!SerialUSB);
   t=micros();
}

void loop() {
   ++i;
   SerialUSB.print(i);
   SerialUSB.print(" ");
   SerialUSB.print((micros()-t)/i);
   SerialUSB.println(" ==========================================================");
}


Instead of Arduino IDE Serial Monitor (which is slow) I used Linux "screen" command:
Code: [Select]
screen /dev/ttyACMO

I was really surprised on the speed I saw, these are typical lines of output:
Code: [Select]
...
1234567 42 ==========================================================
1234568 42 ==========================================================
...


This means that 42us elapse for each line of 70 bytes output sent to T42, which translates to 1.666MB/s!
Code: [Select]
$ bc -lq
1000000/42*70
1666666.66666666666666666640


Hermann.

Go Up