From: Dean Camera Date: Sun, 27 Oct 2013 17:15:03 +0000 (+0100) Subject: Only issue the REPEAT instruction in the clone programmer if needed to reduce protoco... X-Git-Tag: LUFA-140302~55 X-Git-Url: http://git.linex4red.de/pub/USBasp.git/commitdiff_plain/cf41d16bc709c31d7ee8af0432256c8c8a3b4469?ds=inline;hp=-c Only issue the REPEAT instruction in the clone programmer if needed to reduce protocol overhead. --- cf41d16bc709c31d7ee8af0432256c8c8a3b4469 diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c index 06a4f7222..43c540e17 100644 --- a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c +++ b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c @@ -240,9 +240,12 @@ bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_DIRECT << 2) | PDI_DATSIZE_4BYTES); XMEGANVM_SendAddress(ReadAddress); - /* Send the REPEAT command with the specified number of bytes to read */ - XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE); - XPROGTarget_SendByte(ReadSize - 1); + if (ReadSize > 1) + { + /* Send the REPEAT command with the specified number of bytes to read */ + XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE); + XPROGTarget_SendByte(ReadSize - 1); + } /* Send a LD command with indirect access and post-increment to read out the bytes */ XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);