diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2014-04-23 19:16:21 +0200 |
---|---|---|
committer | Matthijs Kooijman <matthijs@stdin.nl> | 2015-01-26 17:03:25 +0100 |
commit | 08c3bfdc9fd5da81932ec9e4df0b645c93f2ebdc (patch) | |
tree | 985a53c7872f47b4920be36edf9dcf3ef1994511 /bootloaders/caterina/Caterina.c | |
parent | 5f2f0ef4c8f44aefe5c715abf28f9eda32fcf67e (diff) |
Disable the RX PCINT inside SoftwareSerial::recv
Before, the interrupt would remain enabled during reception, which would
re-set the PCINT flag because of the level changes inside the received
byte. Because interrupts are globally disabled, this would not
immediately trigger an interrupt, but the flag would be remembered to
trigger another PCINT interrupt immediately after the first one is
processed.
Typically this was not a problem, because the second interrupt would see
the stop bit, or an idle line, and decide that the interrupt triggered
for someone else. However, at high baud rates, this could cause the
next interrupt for the real start bit to be delayed so much that the
byte got corrupted.
By clearing the interrupt mask bit for just the RX pin (as opposed to
the PCINT mask bit for the entire port), any PCINT events on other bits
can still set the PCINT flag and be processed as normal. In this case,
it's likely that there will be corruption, but that's inevitable when
(other) interrupts happen during SoftwareSerial reception.
Diffstat (limited to 'bootloaders/caterina/Caterina.c')
0 files changed, 0 insertions, 0 deletions