aboutsummaryrefslogtreecommitdiff
path: root/bootloaders/lilypad
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2013-04-18 21:34:00 +0200
committerCristian Maglie <c.maglie@bug.st>2014-01-22 09:38:16 +0100
commitdbe23685c27cb1467dc84140e4899a0bf8e23248 (patch)
tree58a78edb538adb629fa97abc9b70784c3c71cfbf /bootloaders/lilypad
parentfa8df58c93844800196453d738bf229a9b44618d (diff)
Fix lockup when writing to HardwareSerial with interrupts disabled
When interrupts are disabled, writing to HardwareSerial could cause a lockup. When the tx buffer is full, a busy-wait loop is used to wait for the interrupt handler to free up a byte in the buffer. However, when interrupts are disabled, this will of course never happen and the Arduino will lock up. This often caused lockups when doing (big) debug printing from an interrupt handler. Additionally, calling flush() with interrupts disabled while transmission was in progress would also cause a lockup. When interrupts are disabled, the code now actively checks the UDRE (UART Data Register Empty) and calls the interrupt handler to free up room if the bit is set. This can lead to delays in interrupt handlers when the serial buffer is full, but a delay is of course always preferred to a lockup. Closes: #672 References: #1147
Diffstat (limited to 'bootloaders/lilypad')
0 files changed, 0 insertions, 0 deletions