From 9c8ed168e5805059db7978e6a9a4ad24347c7a6e Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Wed, 9 Dec 2009 12:01:01 +0000 Subject: Fix inverted bit-banged USART logic in the AVRISP project for PDI programming. Add a delay to the clock toggling in the AVRISP project to ensure that the programming speed does not exceed 10MHz under any conditions to satisfy the limits in the datasheet for all target voltages. Fix incorrect pin being used as the DATA in in PDI programming mode. --- Projects/AVRISP/Lib/PDIProtocol.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Projects/AVRISP/Lib/PDIProtocol.c') diff --git a/Projects/AVRISP/Lib/PDIProtocol.c b/Projects/AVRISP/Lib/PDIProtocol.c index d98c51c43..864d4e9c3 100644 --- a/Projects/AVRISP/Lib/PDIProtocol.c +++ b/Projects/AVRISP/Lib/PDIProtocol.c @@ -110,9 +110,7 @@ static void PDIProtocol_EnterXPROGMode(void) /* Must hold DATA line high for at least 90nS to enable PDI interface */ PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK; asm volatile ("NOP"::); - #if (F_CPU > 8000000) asm volatile ("NOP"::); - #endif /* Toggle CLOCK line 16 times within 100uS of the original 90nS timeout to keep PDI interface enabled */ for (uint8_t i = 0; i < 16; i++) @@ -120,7 +118,7 @@ static void PDIProtocol_EnterXPROGMode(void) /* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */ PDITarget_SendByte(PDI_CMD_KEY); - for (uint8_t i = 0; i < 8; i++) + for (uint8_t i = 0; i < sizeof(PDI_NVMENABLE_KEY); i++) PDITarget_SendByte(PDI_NVMENABLE_KEY[i]); /* Read out the STATUS register to check that NVM access was successfully enabled */ -- cgit v1.2.3