3
votes

I've met this problem that Arduino Due takes more time to complete the serial writing than Mega 2560 or Uno.

Here is the code I'm using to test:

int t1,t2;
void setup() {
  Serial.begin(115200); 
}

void loop() {
  t1=micros();
  Serial.println("ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGH01234567");
  t2=micros();
  Serial.print("time taken: ");
  Serial.println(t2-t1);
  delay(500);
}

It takes Arduino Due 5,500 microseconds while it takes Arduino Mega 2560 600 microseconds.

To change the serial buffer size for the Mega, I know the buffer size is defined in the Hardwareserial.h at C:\Arduino\hardware\arduino\avr\cores\arduino. But I could not find the buffer size definition in the corresponding file for the Arduino Due.

Does anyone know how to make the Arduino Due have a faster serial writing speed? We need to transmit the data wirelessly so we could not use the native port although it's very fast.

Thanks!

2

2 Answers

0
votes

Well, I was looking for that as well, filesearch revealed:

C:\Arduino\hardware\arduino\sam\cores\arduino\RingBuffer.h - line 28

Having the Arduino 1.5.7 and this works for Arduino Due Programming and Native Port.

-1
votes

for ide 1.6.7 path is:

C:\Users\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.7\cores\arduino