diff options
Diffstat (limited to 'Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c')
-rw-r--r-- | Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c | 12 |
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(); } |