I'm running on Arduino Mega with 0018 and the serial port buffer is only holding 127 bytes when the documentation says it holds 128. Can someone verify?
This is only a big deal if you are expecting to be able to store 128 bytes but if I'm right something is wrong.
The hardware serial buffer length is indeed defined as 128 bytes (hardware serial 0018 source):
// Define constants and variables for buffering incoming serial data. We're
// using a ring buffer (I think), in which rx_buffer_head is the index of the
// location to which to write the next incoming character and rx_buffer_tail
// is the index of the location from which to read.
#define RX_BUFFER_SIZE 128
Still I think you're right. The buffer will only allow for a total of 127 characters. The issue being that the pointer logic used with the ring buffer can not distinguish between no data and 128 bytes. The 128th byte could be added to the buffer without overwriting previous data, but once the pointer (rx_buffer_head) advances, it would report zero bytes.
Thanks, I'm working on some wireless serial code and to make sure I understood how the UART behaves I was running some benchmarks (I was playing around) before I complicated things with the wireless stuff. Thanks again. -al