So the first tests I did were on an older Windows PC with probably USB 1.0 or USB 2.0 ports.
I tried doing the same two tests but on my newer MacBook Pro (2019 I think) and got these results:
const byte BYTE_TO_SEND = 170; //b'10101010'.
const unsigned long NUMERATOR = 1000000000;
void setup(){
Serial.begin(115200); //Does nothing on the nano 33 ble sense.
while (!Serial); //Wait for serial port to connect. Needed for native USB on nano 33 ble sense.
}
void loop(){
unsigned long startClock = micros();
for (int i = 1000; i > 0; i--) {
//Serial.write(BYTE_TO_SEND); //11199 bytes/s on nano33blesense PC.
//Serial.write(BYTE_TO_SEND); //19435-19620 bytes/s on portenta h7 PC.
//Serial.write(BYTE_TO_SEND); //9818-10550 bytes/s on nano33blesense Mac.
Serial.write(BYTE_TO_SEND); //36047-37163 bytes/s on portenta h7 Mac.
Serial.flush();
}
unsigned long endClock = micros();
unsigned long bytesPerSecond = NUMERATOR / (endClock-startClock);
Serial.println("");
Serial.print(bytesPerSecond);
Serial.println(" bytes/second");
while(1);
}
Roughly the same for the Nano33; I'm assuming because I had to connect the micro-USBA cable through a thunderbolt hub which is running my display, speakers, usb mouse, keyboard, etc..
However for the Portenta, I think because I was able to plug the USBC-USBC cable directly into the MacBook's thunderbolt port, I received 37163 bytes/s vs. the 19620 bytes/s on the PC!!!