Go Down

Topic: Nice to be able to set individual ring buffer sizes in hardware serial library (Read 2805 times) previous topic - next topic

KineticaRT

I've an application which needs a hardware Serial1 receive buffer of 2048 characters to avoid loss of long data strings at 115,200 baud. Environment is an Arduino Mega 2560 with a (new) Arduino Ethernet Shield.

To get my application to work reliably I've had to 'hack' the Arduino-0022 HardwareSerial driver as follows:


  • I've removed Serial2 and Serial3 ring buffers (ring_buffer rx_buffer2 and ring_buffer rx_buffer3) and code that uses them to save memory

  • I've increase RX_BUFFER_SIZE to 2048



I'm not using Serial2 and Serial3 so the above works fine - although I'm a bit uncomfortable using non-standard core libraries.

However, it would have been nice to be able to set individual buffer sizes of each Serial port, because I'm only receiving fast long string data on one of the 4 ports.

Dynamic allocation of buffer sizes via Serial#.begin or a new Serial#.configure would be great. Actually the other UART configuration features suggested by someone else (bits, parity, etc.) would be great too.

Could these features be considered for a future release please?

Go Up