aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/AVRISP-MKII/Lib
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-12-29 14:54:52 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-12-29 14:54:52 +0000
commitf5951d15936f397afbeb31bf467a90e6e9b5e161 (patch)
tree34e2d592e582e1579dde8a43cfad184a368a0165 /Projects/AVRISP-MKII/Lib
parentb1dbd92c32022c2ec1601f6a6e51c5714a69c56c (diff)
downloadlufa-f5951d15936f397afbeb31bf467a90e6e9b5e161.tar.gz
lufa-f5951d15936f397afbeb31bf467a90e6e9b5e161.tar.bz2
lufa-f5951d15936f397afbeb31bf467a90e6e9b5e161.zip
Reduced guard bit time in the AVRISP project PDI/TPI protocols to reduce the time needed to reverse the data communication direction.
Diffstat (limited to 'Projects/AVRISP-MKII/Lib')
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c11
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c2
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h2
3 files changed, 10 insertions, 5 deletions
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
index 5275cca8d..1633fb24d 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
@@ -124,6 +124,10 @@ static void XPROGProtocol_EnterXPROGMode(void)
XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
XPROGTarget_SendByte(PDI_RESET_KEY);
+ /* Lower direction change guard time to 8 USART bits */
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_CTRL_REG);
+ XPROGTarget_SendByte(0x04);
+
/* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
XPROGTarget_SendByte(PDI_CMD_KEY);
for (uint8_t i = sizeof(PDI_NVMENABLE_KEY); i > 0; i--)
@@ -134,10 +138,13 @@ static void XPROGProtocol_EnterXPROGMode(void)
}
else
{
- #if 0
/* Enable TPI programming mode with the attached target */
XPROGTarget_EnableTargetTPI();
+ /* Lower direction change guard time to 8 USART bits */
+ XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
+ XPROGTarget_SendByte(0x04);
+
/* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
XPROGTarget_SendByte(TPI_CMD_SKEY);
for (uint8_t i = sizeof(TPI_NVMENABLE_KEY); i > 0; i--)
@@ -145,8 +152,6 @@ static void XPROGProtocol_EnterXPROGMode(void)
/* Wait until the NVM bus becomes active */
NVMBusEnabled = TINYNVM_WaitWhileNVMBusBusy();
- #endif
- NVMBusEnabled = true;
}
Endpoint_Write_Byte(CMD_XPROG);
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
index c1f1a6316..a8c798efb 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
@@ -420,7 +420,7 @@ static void XPROGTarget_SetRxMode(void)
}
/* Wait until DATA line has been pulled up to idle by the target */
- while (!(BITBANG_PDIDATA_PIN & BITBANG_PDIDATA_MASK));
+ while (!(BITBANG_PDIDATA_PIN & BITBANG_PDIDATA_MASK) && TimeoutMSRemaining);
#endif
IsSending = false;
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
index dab41f316..33a5827db 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
@@ -81,7 +81,7 @@
#endif
/** Number of cycles between each clock when software USART mode is used */
- #define BITS_BETWEEN_USART_CLOCKS 100
+ #define BITS_BETWEEN_USART_CLOCKS 200
/** Total number of bits in a single USART frame */
#define BITS_IN_USART_FRAME 12