projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't enable the pullup on the target /RESET line in the AVRISP project for PDI mode...
[pub/USBasp.git]
/
Projects
/
AVRISP-MKII
/
Lib
/
XPROG
/
XPROGProtocol.c
diff --git
a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
index
a6a5767
..
08936a2
100644
(file)
--- a/
Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
+++ b/
Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
@@
-119,14
+119,14
@@
static void XPROGProtocol_EnterXPROGMode(void)
{
\r
/* Enable PDI programming mode with the attached target */
\r
XPROGTarget_EnableTargetPDI();
\r
{
\r
/* Enable PDI programming mode with the attached target */
\r
XPROGTarget_EnableTargetPDI();
\r
-
\r
+
\r
/* Store the RESET key into the RESET PDI register to keep the XMEGA in reset */
\r
XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
\r
XPROGTarget_SendByte(PDI_RESET_KEY);
\r
\r
/* Store the RESET key into the RESET PDI register to keep the XMEGA in reset */
\r
XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
\r
XPROGTarget_SendByte(PDI_RESET_KEY);
\r
\r
- /* Lower direction change guard time to
8
USART bits */
\r
+ /* Lower direction change guard time to
0
USART bits */
\r
XPROGTarget_SendByte(PDI_CMD_STCS | PDI_CTRL_REG);
\r
XPROGTarget_SendByte(PDI_CMD_STCS | PDI_CTRL_REG);
\r
- XPROGTarget_SendByte(0x0
4
);
\r
+ XPROGTarget_SendByte(0x0
7
);
\r
\r
/* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
\r
XPROGTarget_SendByte(PDI_CMD_KEY);
\r
\r
/* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
\r
XPROGTarget_SendByte(PDI_CMD_KEY);
\r
@@
-141,9
+141,9
@@
static void XPROGProtocol_EnterXPROGMode(void)
/* Enable TPI programming mode with the attached target */
\r
XPROGTarget_EnableTargetTPI();
\r
\r
/* Enable TPI programming mode with the attached target */
\r
XPROGTarget_EnableTargetTPI();
\r
\r
- /* Lower direction change guard time to
8
USART bits */
\r
+ /* Lower direction change guard time to
0
USART bits */
\r
XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
\r
XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
\r
- XPROGTarget_SendByte(0x0
4
);
\r
+ XPROGTarget_SendByte(0x0
7
);
\r
\r
/* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
\r
XPROGTarget_SendByte(TPI_CMD_SKEY);
\r
\r
/* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
\r
XPROGTarget_SendByte(TPI_CMD_SKEY);
\r
@@
-170,14
+170,22
@@
static void XPROGProtocol_LeaveXPROGMode(void)
\r
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
\r
{
\r
\r
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
\r
{
\r
+ XMEGANVM_WaitWhileNVMBusBusy();
\r
+
\r
/* Clear the RESET key in the RESET PDI register to allow the XMEGA to run */
\r
XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
\r
XPROGTarget_SendByte(0x00);
\r
/* Clear the RESET key in the RESET PDI register to allow the XMEGA to run */
\r
XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
\r
XPROGTarget_SendByte(0x00);
\r
+
\r
+ /* Clear /RESET key twice (for some reason this needs to be done twice to take effect) */
\r
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
\r
+ XPROGTarget_SendByte(0x00);
\r
\r
XPROGTarget_DisableTargetPDI();
\r
}
\r
else
\r
{
\r
\r
XPROGTarget_DisableTargetPDI();
\r
}
\r
else
\r
{
\r
+ TINYNVM_WaitWhileNVMBusBusy();
\r
+
\r
/* Clear the NVMEN bit in the TPI CONTROL register to disable TPI mode */
\r
XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
\r
XPROGTarget_SendByte(0x00);
\r
/* Clear the NVMEN bit in the TPI CONTROL register to disable TPI mode */
\r
XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
\r
XPROGTarget_SendByte(0x00);
\r