PDI NVM enable is fast enough that bare polling is enough without a fixed delay in...
[pub/USBasp.git] / Projects / AVRISP / Lib / PDIProtocol.c
index 32a74c5..2107e2b 100644 (file)
@@ -115,11 +115,9 @@ static void PDIProtocol_EnterXPROGMode(void)
          PDITarget_SendByte(PDI_NVMENABLE_KEY[i - 1]);\r
 \r
        /* Poll the STATUS register to check to see if NVM access has been enabled */\r
          PDITarget_SendByte(PDI_NVMENABLE_KEY[i - 1]);\r
 \r
        /* Poll the STATUS register to check to see if NVM access has been enabled */\r
-       uint8_t NVMAttemptsRemaining = 150;\r
+       uint8_t NVMAttemptsRemaining = 255;\r
        while (NVMAttemptsRemaining)\r
        {\r
        while (NVMAttemptsRemaining)\r
        {\r
-               _delay_ms(1);\r
-\r
                PDITarget_SendByte(PDI_CMD_LDCS | PD_STATUS_REG);\r
                if (PDITarget_ReceiveByte() & PDI_STATUS_NVM)\r
                  break;\r
                PDITarget_SendByte(PDI_CMD_LDCS | PD_STATUS_REG);\r
                if (PDITarget_ReceiveByte() & PDI_STATUS_NVM)\r
                  break;\r