diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-11-16 12:30:00 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-11-16 12:30:00 +0000 |
commit | a9f313afa9a65a692718b8609fd47ae1dcb60523 (patch) | |
tree | c43f06af3c44b189de5982af82ee185fbe86d04a /Projects/AVRISP-MKII/Lib/XPROG | |
parent | 002cd6df49981ad75b2092f2ae6b3efc4e2dd364 (diff) | |
download | lufa-a9f313afa9a65a692718b8609fd47ae1dcb60523.tar.gz lufa-a9f313afa9a65a692718b8609fd47ae1dcb60523.tar.bz2 lufa-a9f313afa9a65a692718b8609fd47ae1dcb60523.zip |
Slow AVRISP-MKII clone PDI/TPI programming speed back to 250KHz due to issues with the XPLAINBridge when PDI programming at faster rates.
Speed up XMEGANVM_WaitWhileNVMControllerBusy() by preloading the status register address into the pointer register of the target's NVM controller and then reading via a faster indirect load command.
Diffstat (limited to 'Projects/AVRISP-MKII/Lib/XPROG')
-rw-r--r-- | Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c | 10 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c index ce02ebe95..60e755265 100644 --- a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c +++ b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c @@ -96,13 +96,15 @@ bool XMEGANVM_WaitWhileNVMBusBusy(void) */ bool XMEGANVM_WaitWhileNVMControllerBusy(void) { + /* Preload the pointer register with the NVM STATUS register address to check the BUSY flag */ + XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_DIRECT << 2) | PDI_DATSIZE_4BYTES); + XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_STATUS); + /* Poll the NVM STATUS register while the NVM controller is busy */ for (;;) { - /* Send a LDS command to read the NVM STATUS register to check the BUSY flag */ - XPROGTarget_SendByte(PDI_CMD_LDS | (PDI_DATSIZE_4BYTES << 2)); - XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_STATUS); - + /* Fetch the current status value via the pointer register (without auto-increment afterwards) */ + XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT << 2) | PDI_DATSIZE_1BYTE); uint8_t StatusRegister = XPROGTarget_ReceiveByte(); /* We might have timed out waiting for the status register read response, check here */ diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h index 8d7181aa2..9f51b2738 100644 --- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h +++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h @@ -56,7 +56,7 @@ #endif /** Serial carrier TPI/PDI speed when hardware TPI/PDI mode is used. */ - #define XPROG_HARDWARE_SPEED 500000 + #define XPROG_HARDWARE_SPEED 250000 /** Total number of bits in a single USART frame. */ #define BITS_IN_USART_FRAME 12 |