Engineering and technology notes

Expanding Arduino Serial Port Buffer Size

Software Serial Buffer Expansion

The change for software serial ports require a simple modification of the file:

<base Arduino folder>\hardware\arduino\avr\libraries\SoftwareSerial\SoftwareSerial.h

Change:

__#define _SS_MAX_RX_BUFF 64 // RX buffer size

To:

__#define _SS_MAX_RX_BUFF 256 // RX buffer size

Hardware Serial Buffer Expansion

The change for hardware serial ports require a simple modification of the file:

<base Arduino folder>\hardware\arduino\avr\cores\arduino\HardwareSerial.h

Change:

__#define SERIAL_TX_BUFFER_SIZE 64
__#define SERIAL_RX_BUFFER_SIZE 64

To:

__#define SERIAL_TX_BUFFER_SIZE 256
__#define SERIAL_RX_BUFFER_SIZE 256

Btw, you can copy the SoftwareSerial.cpp and h files from the Arduino directory in to your project directory and then include it with “(quotation marks) instead of the < (pointy brackets). If you do this, make sure to also change the #include <SoftwareSerial.h> in your copy of SoftwareSerial.cpp to “SoftwareSerial.h”.
~you use <pointy brackets> to include files from arduino libraries and
“quotes” to include from project directory.

Source: Internet of Home Things » Expanding Arduino Serial Port Buffer Size

Expanding Arduino Serial Port Buffer Size was last modified: January 13th, 2021 by Jovan Stosic