aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/AVRISP-MKII/Lib/XPROG
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-11-29 13:33:28 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-11-29 13:33:28 +0000
commit798cc84ff57cf4fee07a7267d76f4e551df15d12 (patch)
tree9a6d4bb22d03d5e0b4aa2428718692cfc0096fc4 /Projects/AVRISP-MKII/Lib/XPROG
parent259a3c98540b85bf06fb80bdf5b3df311a19e352 (diff)
downloadlufa-798cc84ff57cf4fee07a7267d76f4e551df15d12.tar.gz
lufa-798cc84ff57cf4fee07a7267d76f4e551df15d12.tar.bz2
lufa-798cc84ff57cf4fee07a7267d76f4e551df15d12.zip
Fixed AVRISP-MKII Clone failing to start application firmware once a TPI programming session is exited.
Diffstat (limited to 'Projects/AVRISP-MKII/Lib/XPROG')
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
index 26ffb9f10..8d74dd47f 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
@@ -146,9 +146,15 @@ void TINYNVM_DisableTPI(void)
{
TINYNVM_WaitWhileNVMBusBusy();
- /* Clear the NVMEN bit in the TPI STATUS register to disable TPI mode */
- XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_STATUS_REG);
- XPROGTarget_SendByte(0x00);
+ do
+ {
+ /* Clear the NVMEN bit in the TPI STATUS register to disable TPI mode */
+ XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_STATUS_REG);
+ XPROGTarget_SendByte(0x00);
+
+ /* Read back the STATUS register, check to see if it took effect */
+ XPROGTarget_SendByte(TPI_CMD_SLDCS | PDI_RESET_REG);
+ } while (XPROGTarget_ReceiveByte() != 0x00);
XPROGTarget_DisableTargetTPI();
}