AnHardt / Marlin

Reprap FW with look ahead. SDcard and LCD support. It works on Gen6, Ultimaker, RAMPS and Sanguinololu
GNU General Public License v3.0
1 stars 1 forks source link

Make rx tail/head atomic in HardwareSerial #16

Closed AnHardt closed 8 years ago

AnHardt commented 8 years ago

Reading a bit in https://github.com/arduino/Arduino/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+HardwareSerial+ i got the idea we might have a similar problem - having a race condition when program and interrupt are updating tail and head.

Switching from int to 'volatile uint8_t' is save as long the buffers are small enough.

My tests tell about a recognizable reduced error rate at 250000bd.