Go Down

Topic: Increase size of Serial buffer (Read 1 time) previous topic - next topic

tomshirvo

Hi All,

I am working with Xbee and the max size of the serial buffer on it is 100 bytes. So I would like to change the Due from 64 bytes to 100 bytes.

The Arduino Due is so large that I would like to try and make the buffer size for the serial port to be larger.

I am using all of the Serial ports on the Due but would like to make only Serial1 larger.

I have seen stuff out there for changing the Arduino Uno buffer size but that doesn't work with the SAM processor.

Also I have tried to use the serialEvent1() but that still doesn't read the data fast enough to clear the buffer.

Any help would be great.

AWOL

Quote
Also I have tried to use the serialEvent1() but that still doesn't read the data fast enough to clear the buffer

Isn't the trick simply to not spend too long in "loop()", and grab as much as you can during SerialEvent?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

tomshirvo

Well I found out how to change it, just went through all of the files and found which file to change it in.

arduino-1.5.5\hardware\arduino\sam\cores\arduino\RingBuffer.h

Change the value of "#define SERIAL_BUFFER_SIZE 64", I ended up changing it to 256 as I am not using a log of space on the Due at the moment.

Hope this can help others if they have this problem.


do not change RingBuffer.h : Put this at the first line of your project/sketch

Code: [Select]
#define SERIAL_BUFFER_SIZE 256
check it in your sketch with:

Code: [Select]
Serial.print(SERIAL_BUFFER_SIZE);

Collin80

Steffen, I could be wrong but I doubt that'll do any good. C/C++ is compiled on a per-file basis and setting the serial buffer size in your sketch will only set the define for that file. The arduino core is compiled separately and so those files will use the define already existing in RingBuffer.h I don't really see any easy way to fix this.

MorganS

Collin is right. Steffen's suggestion doesn't change the value that the UART class sees. I just created a test sketch and ran it on a Due to check.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy