aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2015-06-18 16:34:53 +0200
committerMatthijs Kooijman <matthijs@stdin.nl>2015-06-18 16:36:07 +0200
commit695d48cc79be523ea2ab64573f4aac011a056496 (patch)
tree18e85fc77f2a7ebe8b446dfa0c46ce0a0c408ca8
parenta0f53f531fe439764658632a47db3a825eda01dc (diff)
Warn about increasing HardwareSerial buffers to > 256
Properly supporting bigger buffers need better atomicity code, which isn't implemented yet. Until it is, best to add a warning. See #2405.
-rw-r--r--cores/arduino/HardwareSerial.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h
index 7f4f162..1beafc5 100644
--- a/cores/arduino/HardwareSerial.h
+++ b/cores/arduino/HardwareSerial.h
@@ -34,6 +34,11 @@
// location from which to read.
// NOTE: a "power of 2" buffer size is reccomended to dramatically
// optimize all the modulo operations for ring buffers.
+// WARNING: When buffer sizes are increased to > 256, the buffer index
+// variables are automatically increased in size, but the extra
+// atomicity guards needed for that are not implemented. This will
+// often work, but occasionally a race condition can occur that makes
+// Serial behave erratically. See https://github.com/arduino/Arduino/issues/2405
#if !defined(SERIAL_TX_BUFFER_SIZE)
#if (RAMEND < 1000)
#define SERIAL_TX_BUFFER_SIZE 16