diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-12-15 00:14:17 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-12-15 00:14:17 +0000 |
commit | a7880ac1cdbfe8ddaf957173bc08f334aad8bca7 (patch) | |
tree | b2119bd8eaa823940abda4ce596ff195d9bf84f1 /Projects/AVRISP/Lib/PDITarget.c | |
parent | bb3879331211a19c3adc3927cac870cc7e36b775 (diff) | |
download | lufa-a7880ac1cdbfe8ddaf957173bc08f334aad8bca7.tar.gz lufa-a7880ac1cdbfe8ddaf957173bc08f334aad8bca7.tar.bz2 lufa-a7880ac1cdbfe8ddaf957173bc08f334aad8bca7.zip |
Fix error in AVRISP programmer when repeatedly using PDI mode via the hardware USART due to the SendByte routine not clearing the Transmit Complete USART flag.
Diffstat (limited to 'Projects/AVRISP/Lib/PDITarget.c')
-rw-r--r-- | Projects/AVRISP/Lib/PDITarget.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Projects/AVRISP/Lib/PDITarget.c b/Projects/AVRISP/Lib/PDITarget.c index c774fdab8..28df55021 100644 --- a/Projects/AVRISP/Lib/PDITarget.c +++ b/Projects/AVRISP/Lib/PDITarget.c @@ -102,7 +102,7 @@ void PDITarget_EnableTargetPDI(void) /* Set up the synchronous USART for XMEGA communications -
8 data bits, even parity, 2 stop bits */
- UBRR1 = 10;
+ UBRR1 = (F_CPU / 1000000UL);
UCSR1B = (1 << TXEN1);
UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
@@ -167,15 +167,16 @@ void PDITarget_SendByte(uint8_t Byte) PORTD |= (1 << 3);
DDRD |= (1 << 3);
- UCSR1B &= ~(1 << RXEN1);
UCSR1B |= (1 << TXEN1);
+ UCSR1B &= ~(1 << RXEN1);
IsSending = true;
}
/* Wait until there is space in the hardware Tx buffer before writing */
while (!(UCSR1A & (1 << UDRE1)));
- UDR1 = Byte;
+ UCSR1A |= (1 << TXC1);
+ UDR1 = Byte;
#else
/* Switch to Tx mode if currently in Rx mode */
if (!(IsSending))
|