X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/a5adbae652bcf5382ef34d71da4d11de15b482a6..7aecda6fda5bcced68d72b0cf73d00174aa5c7cd:/Projects/AVRISP/Lib/PDIProtocol.c?ds=sidebyside diff --git a/Projects/AVRISP/Lib/PDIProtocol.c b/Projects/AVRISP/Lib/PDIProtocol.c index 2ed3ff293..864d4e9c3 100644 --- a/Projects/AVRISP/Lib/PDIProtocol.c +++ b/Projects/AVRISP/Lib/PDIProtocol.c @@ -28,7 +28,7 @@ this software. */ -#if defined(ENABLE_XPROG_PROTOCOL) +#if defined(ENABLE_PDI_PROTOCOL) || defined(__DOXYGEN__) #warning PDI Programming Protocol support is incomplete and not currently suitable for use. @@ -109,7 +109,8 @@ static void PDIProtocol_EnterXPROGMode(void) /* Must hold DATA line high for at least 90nS to enable PDI interface */ PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK; - _delay_us(1); + asm volatile ("NOP"::); + asm volatile ("NOP"::); /* 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++) @@ -117,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 */