Hardware serial buffer size

I am developing a project which needs to accept bursts of chars from hardware serial, preferably up to 256 bytes at a time. So I dug into the Hardwareserial.cpp to find out the size of the RX buffer. Here is what I found:

#if (RAMEND < 1000)
#define RX_BUFFER_SIZE 32
#else
#define RX_BUFFER_SIZE 128
#endif

struct ring_buffer
{
unsigned char buffer[RX_BUFFER_SIZE];
int head;
int tail;
};

I looked everywhere in it include files and can’t find what RAMEND is. Is it defined somewhere? I know I can just make a bold change to increase the buffer to 256 but I’d like to be less intrusive, at least understand how RAMEND was defined, maybe in some core files I know nothing about.

BTW, when a new byte comes in the buffer is filled without interrupting the CPU, or is the buffer filled by interrupts? The HardwareSerial.cpp has too many registers for me to fully understand. Thanks!

I looked everywhere in it include files and can’t find what RAMEND is. Is it defined somewhere? I know I can just make a bold change to increase the buffer to 256 but I’d like to be less intrusive, at least understand how RAMEND was defined, maybe in some core files I know nothing about.

Well no real need to find it I think. The #if (RAMEND < 1000) would indicate a very old arduino board based on the meg8 chip. And the
#else
#define RX_BUFFER_SIZE 128

Would cover the 168/328/1280/2560 chips, so just change the 128 to 256 and your receiver buffer will be 256 bytes.

BTW, when a new byte comes in the buffer is filled without interrupting the CPU, or is the buffer filled by interrupts? The HardwareSerial.cpp has too many registers for me to fully understand. Thanks!

The received buffer is filled via interrupts.
Lefty

Thanks Lefty. I'll make the change then. I might need some crash course on those registers sometime. I really want to understand the library someday.

I have a question regarding the VISA Bytes at port. I am using Labview 7.1 and utilizes serial communication.

"Bytes at port" shows how many bytes there is in the incoming buffer (correct??).

My questions is about how much buffer size Labview "lends" from the PC to this function, ie. how much of the RAM is used for buffering on, lets say, an ordinary PC??

I am getting bytes up to app. 9000-10 000 in my "Bytes at Port", which leads me to the question that maybee the buffer can be overun?? Is that possible, or has Labview that in mind????

I am using a baudrate of 115200 kbps now, but would like to increase the speed to app. 200 kbps. The hardware I am using is a USB Bluetooth dongle for receiving, so the PC looks at this as a COM port.

I am using a baudrate of 115200 kbps now, but would like to increase the speed to app. 200 kbps. The hardware I am using is a USB Bluetooth dongle for receiving, so the PC looks at this as a COM port.

Regardless of the actual hardware involved, the Arduino's maximum supported baud rate is 115200.

The various pieces of hardware between the Arduino and the PC may limit that to lower values, but they can not increase it.