Closed
Description
This is Issue 1008 moved from a Google Code project.
Added by 2012-08-17T23:16:20.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Enhancement, Priority-Medium, Component-Core
Original description
Each serial buffer transmission results in 1 extra interrupt to detect the TX
buffer being empty (verified with O-Scope).
Using USART3 as an example, here's an easy fix to remove this extra interrupt.
EXISTING:
ISR(USART3_UDRE_vect)
{
if (tx_buffer3.head == tx_buffer3.tail) {
// Buffer empty, so disable interrupts
cbi(UCSR3B, UDRIE3);
}
else {
// There is more data in the output buffer. Send the next byte
unsigned char c = tx_buffer3.buffer[tx_buffer3.tail];
tx_buffer3.tail = (tx_buffer3.tail + 1) % SERIAL_BUFFER_SIZE;
UDR3 = c;
}
}
NEW:
ISR(USART3_UDRE_vect)
{
// There is more data in the output buffer. Send the next byte
unsigned char c = tx_buffer3.buffer[tx_buffer3.tail];
tx_buffer3.tail = (tx_buffer3.tail + 1) % SERIAL_BUFFER_SIZE;
UDR3 = c;
if (tx_buffer3.head == tx_buffer3.tail) {
// Buffer empty, so disable interrupts
cbi(UCSR3B, UDRIE3);
}
}
Metadata
Metadata
Assignees
Labels
No labels