From db73b11244c2c5dc444f3c459d6823be8d1fe655 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Fri, 7 Oct 2011 04:40:56 +0000 Subject: Added reliability patches to the AVRISP-MKII Clone project's ISP and PDI/TPI protocols (thanks to Justin Mattair). --- Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Projects/AVRISP-MKII/Lib/XPROG') diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c index af0cc0106..065cd0965 100644 --- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c +++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c @@ -174,9 +174,14 @@ void XPROGTarget_SendIdle(void) static void XPROGTarget_SetTxMode(void) { - /* Wait for a full cycle of the clock */ - while (PIND & (1 << 5)); - while (!(PIND & (1 << 5))); + /* Need to do nothing for a full frame to send a BREAK - only one cycle should be needed, however + * there are reports that sometimes the interface will get stuck in some environments. */ + for (uint8_t i = 0; i < BITS_IN_USART_FRAME; i++) + { + /* Wait for a full cycle of the clock */ + while (PIND & (1 << 5)); + while (!(PIND & (1 << 5))); + } PORTD |= (1 << 3); DDRD |= (1 << 3); -- cgit v1.2.3