Skip to content

Commit cd56786

Browse files
committed
Merge pull request #3361 from matthijskooijman/hardware-serial-warn-256
Warn about increasing HardwareSerial buffers to > 256
2 parents 3076c63 + 07c4d95 commit cd56786

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hardware/arduino/avr/cores/arduino/HardwareSerial.h

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
// location from which to read.
3535
// NOTE: a "power of 2" buffer size is reccomended to dramatically
3636
// optimize all the modulo operations for ring buffers.
37+
// WARNING: When buffer sizes are increased to > 256, the buffer index
38+
// variables are automatically increased in size, but the extra
39+
// atomicity guards needed for that are not implemented. This will
40+
// often work, but occasionally a race condition can occur that makes
41+
// Serial behave erratically. See https://github.com/arduino/Arduino/issues/2405
3742
#if !defined(SERIAL_TX_BUFFER_SIZE)
3843
#if (RAMEND < 1000)
3944
#define SERIAL_TX_BUFFER_SIZE 16

0 commit comments

Comments
 (0)