aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2010-01-31 12:25:53 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2010-01-31 12:25:53 +0000
commitf34b00f7484fbdcbc5879c518a8d15d79bad8da2 (patch)
tree18c79d5944ffcfb07f8007ba42a693ba07a98114
parent2d886793afd3d99af2d63ff8edfdcdf9569a5ede (diff)
Oops - PDI handshake delay was too long, causing the device's /RESET functionality to be re-enabled.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1086 d5102386-fcda-11dd-9fdb-3debd5008f28
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
index 0f590c71..843bf5a7 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
@@ -152,9 +152,11 @@ void XPROGTarget_EnableTargetPDI(void)
DDRD |= (1 << 5) | (1 << 3);
DDRD &= ~(1 << 2);
- /* Set DATA line high for at least 90ns to disable /RESET functionality */
+ /* Set DATA line high for at least 90ns to disable /RESET functionality (note: too long will enable it again,
+ * so a fixed number of NOPs are used here */
PORTD |= (1 << 3);
- _delay_ms(1);
+ asm volatile ("NOP"::);
+ asm volatile ("NOP"::);
/* Set up the synchronous USART for XMEGA communications -
8 data bits, even parity, 2 stop bits */
@@ -166,9 +168,11 @@ void XPROGTarget_EnableTargetPDI(void)
BITBANG_PDIDATA_DDR |= BITBANG_PDIDATA_MASK;
BITBANG_PDICLOCK_DDR |= BITBANG_PDICLOCK_MASK;
- /* Set DATA line high for at least 90ns to disable /RESET functionality */
+ /* Set DATA line high for at least 90ns to disable /RESET functionality (note: too long will enable it again,
+ * so a fixed number of NOPs are used here */
BITBANG_PDIDATA_PORT |= BITBANG_PDIDATA_MASK;
- _delay_ms(1);
+ asm volatile ("NOP"::);
+ asm volatile ("NOP"::);
/* Fire timer compare channel A ISR to manage the software USART */
OCR1A = BITS_BETWEEN_USART_CLOCKS;