From 33a46b243a0f204f3ade095f7b213d9d2598c450 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Fri, 11 Dec 2009 04:56:52 +0000 Subject: PDI NVM enable is fast enough that bare polling is enough without a fixed delay in between each attempt. Make sure the USART transmitter is enabled explicitly when the USART is configured, so that repeated attempts to re-enter PDI mode don't fail due to TXEN not being set. --- 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 32a74c586..2107e2b89 100644 --- a/Projects/AVRISP/Lib/PDIProtocol.c +++ b/Projects/AVRISP/Lib/PDIProtocol.c @@ -115,11 +115,9 @@ static void PDIProtocol_EnterXPROGMode(void) PDITarget_SendByte(PDI_NVMENABLE_KEY[i - 1]); /* Poll the STATUS register to check to see if NVM access has been enabled */ - uint8_t NVMAttemptsRemaining = 150; + uint8_t NVMAttemptsRemaining = 255; while (NVMAttemptsRemaining) { - _delay_ms(1); - PDITarget_SendByte(PDI_CMD_LDCS | PD_STATUS_REG); if (PDITarget_ReceiveByte() & PDI_STATUS_NVM) break; -- cgit v1.2.3