projects
/
pub
/
USBasp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f69f03c
)
Document the PDI programming routines implemented so far in the AVRISP project. Add...
author
Dean Camera
<dean@fourwalledcubicle.com>
Thu, 3 Dec 2009 07:42:56 +0000
(07:42 +0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Thu, 3 Dec 2009 07:42:56 +0000
(07:42 +0000)
LUFA/ManPages/ChangeLog.txt
patch
|
blob
|
blame
|
history
Projects/AVRISP/AVRISP.txt
patch
|
blob
|
blame
|
history
Projects/AVRISP/Doxygen.conf
patch
|
blob
|
blame
|
history
Projects/AVRISP/Lib/ISPProtocol.c
patch
|
blob
|
blame
|
history
Projects/AVRISP/Lib/ISPTarget.c
patch
|
blob
|
blame
|
history
Projects/AVRISP/Lib/PDIProtocol.c
patch
|
blob
|
blame
|
history
Projects/AVRISP/Lib/PDIProtocol.h
patch
|
blob
|
blame
|
history
Projects/AVRISP/Lib/PDITarget.c
patch
|
blob
|
blame
|
history
Projects/AVRISP/Lib/PDITarget.h
patch
|
blob
|
blame
|
history
Projects/AVRISP/Lib/V2Protocol.c
patch
|
blob
|
blame
|
history
Projects/AVRISP/makefile
patch
|
blob
|
blame
|
history
diff --git
a/LUFA/ManPages/ChangeLog.txt
b/LUFA/ManPages/ChangeLog.txt
index
bd3b38f
..
bbded93
100644
(file)
--- a/
LUFA/ManPages/ChangeLog.txt
+++ b/
LUFA/ManPages/ChangeLog.txt
@@
-16,6
+16,7
@@
* - Added new RNDIS Ethernet Host Class Driver
\r
* - Added new RNDIS Ethernet Host ClassDriver demo
\r
* - Added CDC_Host_Flush() function to the CDC Host Class driver to flush sent data to the attached device
\r
* - Added new RNDIS Ethernet Host Class Driver
\r
* - Added new RNDIS Ethernet Host ClassDriver demo
\r
* - Added CDC_Host_Flush() function to the CDC Host Class driver to flush sent data to the attached device
\r
+ * - Added PDI programming support for XMEGA devices to the AVRISP programmer project
\r
*
\r
* <b>Changed:</b>
\r
* - Removed code in the Keyboard demos to send zeroed reports between two reports with differing numbers of keycodes
\r
*
\r
* <b>Changed:</b>
\r
* - Removed code in the Keyboard demos to send zeroed reports between two reports with differing numbers of keycodes
\r
diff --git
a/Projects/AVRISP/AVRISP.txt
b/Projects/AVRISP/AVRISP.txt
index
670c168
..
c533af7
100644
(file)
--- a/
Projects/AVRISP/AVRISP.txt
+++ b/
Projects/AVRISP/AVRISP.txt
@@
-178,6
+178,11
@@
* <td>ADC channel number (on supported AVRs) to use for VTARGET level detection.</td>
\r
* </tr>
\r
* <tr>
\r
* <td>ADC channel number (on supported AVRs) to use for VTARGET level detection.</td>
\r
* </tr>
\r
* <tr>
\r
+ * <td>ENABLE_SPI_PROTOCOL</td>
\r
+ * <td>Makefile CDEFS</td>
\r
+ * <td>Define to enable SPI programming protocol support.</td>
\r
+ * </tr>
\r
+ * <tr>
\r
* <td>ENABLE_XPROG_PROTOCOL</td>
\r
* <td>Makefile CDEFS</td>
\r
* <td>Define to enable XMEGA PDI programming protocol support.</td>
\r
* <td>ENABLE_XPROG_PROTOCOL</td>
\r
* <td>Makefile CDEFS</td>
\r
* <td>Define to enable XMEGA PDI programming protocol support.</td>
\r
diff --git
a/Projects/AVRISP/Doxygen.conf
b/Projects/AVRISP/Doxygen.conf
index
eb8a1ab
..
dcaaecb
100644
(file)
--- a/
Projects/AVRISP/Doxygen.conf
+++ b/
Projects/AVRISP/Doxygen.conf
@@
-1221,7
+1221,7
@@
INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator
\r
# instead of the = operator.
\r
\r
# undefined via #undef or recursively expanded use the := operator
\r
# instead of the = operator.
\r
\r
-PREDEFINED = __DOXYGEN__
\r
+PREDEFINED = __DOXYGEN__
ENABLE_SPI_PROTOCOL ENABLE_PDI_PROTOCOL
\r
\r
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
\r
# this tag can be used to specify a list of macro names that should be expanded.
\r
\r
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
\r
# this tag can be used to specify a list of macro names that should be expanded.
\r
diff --git
a/Projects/AVRISP/Lib/ISPProtocol.c
b/Projects/AVRISP/Lib/ISPProtocol.c
index
c023234
..
4847c35
100644
(file)
--- a/
Projects/AVRISP/Lib/ISPProtocol.c
+++ b/
Projects/AVRISP/Lib/ISPProtocol.c
@@
-28,6
+28,8
@@
this software.
\r
*/
\r
\r
this software.
\r
*/
\r
\r
+#if defined(ENABLE_SPI_PROTOCOL)
\r
+
\r
/** \file
\r
*
\r
* ISP Protocol handler, to process V2 Protocol wrapped ISP commands used in Atmel programmer devices.
\r
/** \file
\r
*
\r
* ISP Protocol handler, to process V2 Protocol wrapped ISP commands used in Atmel programmer devices.
\r
@@
-468,3
+470,5
@@
void ISPProtocol_SPIMulti(void)
Endpoint_Write_Byte(STATUS_CMD_OK);
\r
Endpoint_ClearIN();
\r
}
\r
Endpoint_Write_Byte(STATUS_CMD_OK);
\r
Endpoint_ClearIN();
\r
}
\r
+
\r
+#endif
\ No newline at end of file
diff --git
a/Projects/AVRISP/Lib/ISPTarget.c
b/Projects/AVRISP/Lib/ISPTarget.c
index
8715846
..
aab64a9
100644
(file)
--- a/
Projects/AVRISP/Lib/ISPTarget.c
+++ b/
Projects/AVRISP/Lib/ISPTarget.c
@@
-28,6
+28,8
@@
this software.
\r
*/
\r
\r
this software.
\r
*/
\r
\r
+#if defined(ENABLE_SPI_PROTOCOL)
\r
+
\r
/** \file
\r
*
\r
* Target-related functions for the ISP Protocol decoder.
\r
/** \file
\r
*
\r
* Target-related functions for the ISP Protocol decoder.
\r
@@
-178,3
+180,5
@@
void ISPTarget_LoadExtendedAddress(void)
SPI_SendByte((CurrentAddress & 0x00FF0000) >> 16);
\r
SPI_SendByte(0x00);
\r
}
\r
SPI_SendByte((CurrentAddress & 0x00FF0000) >> 16);
\r
SPI_SendByte(0x00);
\r
}
\r
+
\r
+#endif
\r
diff --git
a/Projects/AVRISP/Lib/PDIProtocol.c
b/Projects/AVRISP/Lib/PDIProtocol.c
index
c919561
..
2ed3ff2
100644
(file)
--- a/
Projects/AVRISP/Lib/PDIProtocol.c
+++ b/
Projects/AVRISP/Lib/PDIProtocol.c
@@
-30,6
+30,8
@@
\r
#if defined(ENABLE_XPROG_PROTOCOL)
\r
\r
\r
#if defined(ENABLE_XPROG_PROTOCOL)
\r
\r
+#warning PDI Programming Protocol support is incomplete and not currently suitable for use.
\r
+
\r
/** \file
\r
*
\r
* PDI Protocol handler, to process V2 Protocol wrapped PDI commands used in Atmel programmer devices.
\r
/** \file
\r
*
\r
* PDI Protocol handler, to process V2 Protocol wrapped PDI commands used in Atmel programmer devices.
\r
@@
-61,6
+63,9
@@
void PDIProtocol_XPROG_SetMode(void)
Endpoint_ClearIN();
\r
}
\r
\r
Endpoint_ClearIN();
\r
}
\r
\r
+/** Handler for the CMD_XPROG command, which wraps up XPROG commands in a V2 wrapper which need to be
\r
+ * removed and processed so that the underlying XPROG command can be handled.
\r
+ */
\r
void PDIProtocol_XPROG_Command(void)
\r
{
\r
uint8_t XPROGCommand = Endpoint_Read_Byte();
\r
void PDIProtocol_XPROG_Command(void)
\r
{
\r
uint8_t XPROGCommand = Endpoint_Read_Byte();
\r
@@
-74,7
+79,7
@@
void PDIProtocol_XPROG_Command(void)
PDIProtocol_LeaveXPROGMode();
\r
break;
\r
case XPRG_CMD_ERASE:
\r
PDIProtocol_LeaveXPROGMode();
\r
break;
\r
case XPRG_CMD_ERASE:
\r
- PDIProtocol_Erase
Chip
();
\r
+ PDIProtocol_Erase();
\r
break;
\r
case XPRG_CMD_WRITE_MEM:
\r
PDIProtocol_WriteMemory();
\r
break;
\r
case XPRG_CMD_WRITE_MEM:
\r
PDIProtocol_WriteMemory();
\r
@@
-91,6
+96,7
@@
void PDIProtocol_XPROG_Command(void)
}
\r
}
\r
\r
}
\r
}
\r
\r
+/** Handler for the XPROG ENTER_PROGMODE command to establish a PDI connection with the attached device. */
\r
static void PDIProtocol_EnterXPROGMode(void)
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
static void PDIProtocol_EnterXPROGMode(void)
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
@@
-101,22
+107,20
@@
static void PDIProtocol_EnterXPROGMode(void)
PDIDATA_LINE_DDR |= PDIDATA_LINE_MASK;
\r
PDICLOCK_LINE_DDR |= PDICLOCK_LINE_MASK;
\r
\r
PDIDATA_LINE_DDR |= PDIDATA_LINE_MASK;
\r
PDICLOCK_LINE_DDR |= PDICLOCK_LINE_MASK;
\r
\r
+ /* Must hold DATA line high for at least 90nS to enable PDI interface */
\r
PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;
\r
PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;
\r
-
\r
_delay_us(1);
\r
\r
_delay_us(1);
\r
\r
+ /* Toggle CLOCK line 16 times within 100uS of the original 90nS timeout to keep PDI interface enabled */
\r
for (uint8_t i = 0; i < 16; i++)
\r
for (uint8_t i = 0; i < 16; i++)
\r
- {
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- }
\r
-
\r
- static const uint8_t NVMKey[8] = {0x12, 0x89, 0xAB, 0x45, 0xCD, 0xD8, 0x88, 0xFF};
\r
+ TOGGLE_PDI_CLOCK;
\r
\r
\r
+ /* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
\r
PDITarget_SendByte(PDI_CMD_KEY);
\r
for (uint8_t i = 0; i < 8; i++)
\r
PDITarget_SendByte(PDI_CMD_KEY);
\r
for (uint8_t i = 0; i < 8; i++)
\r
- PDITarget_SendByte(
NVMKey
[i]);
\r
+ PDITarget_SendByte(
PDI_NVMENABLE_KEY
[i]);
\r
\r
\r
+ /* Read out the STATUS register to check that NVM access was successfully enabled */
\r
PDITarget_SendByte(PDI_CMD_LDCS | PD_STATUS_REG);
\r
if (!(PDITarget_ReceiveByte() & PDI_STATUS_NVM))
\r
ReturnStatus = XPRG_ERR_FAILED;
\r
PDITarget_SendByte(PDI_CMD_LDCS | PD_STATUS_REG);
\r
if (!(PDITarget_ReceiveByte() & PDI_STATUS_NVM))
\r
ReturnStatus = XPRG_ERR_FAILED;
\r
@@
-127,14
+131,19
@@
static void PDIProtocol_EnterXPROGMode(void)
Endpoint_ClearIN();
\r
}
\r
\r
Endpoint_ClearIN();
\r
}
\r
\r
+/** Handler for the XPROG LEAVE_PROGMODE command to terminate the PDI programming connection with
\r
+ * the attached device.
\r
+ */
\r
static void PDIProtocol_LeaveXPROGMode(void)
\r
{
\r
Endpoint_ClearOUT();
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
static void PDIProtocol_LeaveXPROGMode(void)
\r
{
\r
Endpoint_ClearOUT();
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
+ /* Set DATA and CLOCK lines to inputs */
\r
PDIDATA_LINE_DDR &= ~PDIDATA_LINE_MASK;
\r
PDICLOCK_LINE_DDR &= ~PDICLOCK_LINE_MASK;
\r
PDIDATA_LINE_DDR &= ~PDIDATA_LINE_MASK;
\r
PDICLOCK_LINE_DDR &= ~PDICLOCK_LINE_MASK;
\r
-
\r
+
\r
+ /* Tristate DATA and CLOCK lines */
\r
PDIDATA_LINE_PORT &= ~PDIDATA_LINE_MASK;
\r
PDICLOCK_LINE_PORT &= ~PDICLOCK_LINE_MASK;
\r
\r
PDIDATA_LINE_PORT &= ~PDIDATA_LINE_MASK;
\r
PDICLOCK_LINE_PORT &= ~PDICLOCK_LINE_MASK;
\r
\r
@@
-144,7
+153,8
@@
static void PDIProtocol_LeaveXPROGMode(void)
Endpoint_ClearIN();
\r
}
\r
\r
Endpoint_ClearIN();
\r
}
\r
\r
-static void PDIProtocol_EraseChip(void)
\r
+/** Handler for the XPRG ERASE command to erase a specific memory address space in the attached device. */
\r
+static void PDIProtocol_Erase(void)
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
\r
@@
-167,6
+177,7
@@
static void PDIProtocol_EraseChip(void)
Endpoint_ClearIN();
\r
}
\r
\r
Endpoint_ClearIN();
\r
}
\r
\r
+/** Handler for the XPROG WRITE_MEMORY command to write to a specific memory space within the attached device. */
\r
static void PDIProtocol_WriteMemory(void)
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
static void PDIProtocol_WriteMemory(void)
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
@@
-196,6
+207,9
@@
static void PDIProtocol_WriteMemory(void)
Endpoint_ClearIN();
\r
}
\r
\r
Endpoint_ClearIN();
\r
}
\r
\r
+/** Handler for the XPROG READ_MEMORY command to read data from a specific address space within the
\r
+ * attached device.
\r
+ */
\r
static void PDIProtocol_ReadMemory(void)
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
static void PDIProtocol_ReadMemory(void)
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
@@
-219,23
+233,13
@@
static void PDIProtocol_ReadMemory(void)
Endpoint_Write_Byte(CMD_XPROG);
\r
Endpoint_Write_Byte(XPRG_CMD_READ_MEM);
\r
Endpoint_Write_Byte(ReturnStatus);
\r
Endpoint_Write_Byte(CMD_XPROG);
\r
Endpoint_Write_Byte(XPRG_CMD_READ_MEM);
\r
Endpoint_Write_Byte(ReturnStatus);
\r
-
\r
- // START TEMP
\r
- uint8_t ProgData[256];
\r
- for (uint16_t i = 0; i < ReadMemory_XPROG_Params.Length; i++)
\r
- ProgData[i] = i;
\r
- Endpoint_Write_Stream_LE(ProgData, ReadMemory_XPROG_Params.Length);
\r
-
\r
- if (!Endpoint_IsReadWriteAllowed())
\r
- {
\r
- Endpoint_ClearIN();
\r
- while(!(Endpoint_IsReadWriteAllowed()));
\r
- }
\r
- // END TEMP
\r
\r
Endpoint_ClearIN();
\r
}
\r
\r
\r
Endpoint_ClearIN();
\r
}
\r
\r
+/** Handler for the XPROG CRC command to read a specific memory space's CRC value for comparison between the
\r
+ * attached device's memory and a data set on the host.
\r
+ */
\r
static void PDIProtocol_ReadCRC(void)
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
static void PDIProtocol_ReadCRC(void)
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
@@
-262,6
+266,9
@@
static void PDIProtocol_ReadCRC(void)
Endpoint_ClearIN();
\r
}
\r
\r
Endpoint_ClearIN();
\r
}
\r
\r
+/** Handler for the XPROG SET_PARAM command to set a PDI parameter for use when communicating with the
\r
+ * attached device.
\r
+ */
\r
static void PDIProtocol_SetParam(void)
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
static void PDIProtocol_SetParam(void)
\r
{
\r
uint8_t ReturnStatus = XPRG_ERR_OK;
\r
diff --git
a/Projects/AVRISP/Lib/PDIProtocol.h
b/Projects/AVRISP/Lib/PDIProtocol.h
index
53388d0
..
406ba27
100644
(file)
--- a/
Projects/AVRISP/Lib/PDIProtocol.h
+++ b/
Projects/AVRISP/Lib/PDIProtocol.h
@@
-92,7
+92,7
@@
static void PDIProtocol_EnterXPROGMode(void);
\r
static void PDIProtocol_LeaveXPROGMode(void);
\r
static void PDIProtocol_SetParam(void);
\r
static void PDIProtocol_EnterXPROGMode(void);
\r
static void PDIProtocol_LeaveXPROGMode(void);
\r
static void PDIProtocol_SetParam(void);
\r
- static void PDIProtocol_Erase
Chip
(void);
\r
+ static void PDIProtocol_Erase(void);
\r
static void PDIProtocol_WriteMemory(void);
\r
static void PDIProtocol_ReadMemory(void);
\r
static void PDIProtocol_ReadCRC(void);
\r
static void PDIProtocol_WriteMemory(void);
\r
static void PDIProtocol_ReadMemory(void);
\r
static void PDIProtocol_ReadCRC(void);
\r
diff --git
a/Projects/AVRISP/Lib/PDITarget.c
b/Projects/AVRISP/Lib/PDITarget.c
index
57a1a29
..
d104206
100644
(file)
--- a/
Projects/AVRISP/Lib/PDITarget.c
+++ b/
Projects/AVRISP/Lib/PDITarget.c
@@
-38,12
+38,16
@@
#define INCLUDE_FROM_PDITARGET_C
\r
#include "PDITarget.h"
\r
\r
#define INCLUDE_FROM_PDITARGET_C
\r
#include "PDITarget.h"
\r
\r
+/** Writes a given byte to the attached XMEGA device, using a RS232 frame via software through the
\r
+ * PDI interface.
\r
+ *
\r
+ * \param Byte Byte to send to the attached device
\r
+ */
\r
void PDITarget_SendByte(uint8_t Byte)
\r
{
\r
void PDITarget_SendByte(uint8_t Byte)
\r
{
\r
- PDIDATA_LINE_PORT
&= ~PDIDATA_LINE_MASK;
\r
+ PDIDATA_LINE_PORT &= ~PDIDATA_LINE_MASK;
\r
\r
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
+ TOGGLE_PDI_CLOCK;
\r
\r
for (uint8_t i = 0; i < 8; i++)
\r
{
\r
\r
for (uint8_t i = 0; i < 8; i++)
\r
{
\r
@@
-54,33
+58,28
@@
void PDITarget_SendByte(uint8_t Byte)
\r
Byte >>= 1;
\r
\r
\r
Byte >>= 1;
\r
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
+ TOGGLE_PDI_CLOCK;
\r
}
\r
\r
}
\r
\r
- PDIDATA_LINE_PORT
|= PDIDATA_LINE_MASK;
\r
+ PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;
\r
\r
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
+ TOGGLE_PDI_CLOCK;
\r
+ TOGGLE_PDI_CLOCK;
\r
}
\r
\r
}
\r
\r
+/** Reads a given byte from the attached XMEGA device, encoded in a RS232 frame through the PDI interface.
\r
+ *
\r
+ * \return Received byte from the attached device
\r
+ */
\r
uint8_t PDITarget_ReceiveByte(void)
\r
{
\r
uint8_t ReceivedByte = 0;
\r
\r
uint8_t PDITarget_ReceiveByte(void)
\r
{
\r
uint8_t ReceivedByte = 0;
\r
\r
- PDIDATA_LINE_DDR
&= ~PDIDATA_LINE_MASK;
\r
+ PDIDATA_LINE_DDR &= ~PDIDATA_LINE_MASK;
\r
\r
\r
- bool FoundStartBit;
\r
-
\r
- do
\r
- {
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- FoundStartBit = !(PDIDATA_LINE_PIN & PDIDATA_LINE_MASK);
\r
- } while (!FoundStartBit);
\r
-
\r
+ while (PDIDATA_LINE_PIN & PDIDATA_LINE_MASK);
\r
+ TOGGLE_PDI_CLOCK;
\r
+
\r
for (uint8_t i = 0; i < 8; i++)
\r
{
\r
if (PDIDATA_LINE_PIN & PDIDATA_LINE_MASK)
\r
for (uint8_t i = 0; i < 8; i++)
\r
{
\r
if (PDIDATA_LINE_PIN & PDIDATA_LINE_MASK)
\r
@@
-88,16
+87,13
@@
uint8_t PDITarget_ReceiveByte(void)
\r
ReceivedByte <<= 1;
\r
\r
\r
ReceivedByte <<= 1;
\r
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
+ TOGGLE_PDI_CLOCK;
\r
}
\r
\r
}
\r
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
- PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK;
\r
+ TOGGLE_PDI_CLOCK;
\r
+ TOGGLE_PDI_CLOCK;
\r
\r
\r
- PDIDATA_LINE_DDR
|= PDIDATA_LINE_MASK;
\r
+ PDIDATA_LINE_DDR |= PDIDATA_LINE_MASK;
\r
\r
return ReceivedByte;
\r
}
\r
\r
return ReceivedByte;
\r
}
\r
diff --git
a/Projects/AVRISP/Lib/PDITarget.h
b/Projects/AVRISP/Lib/PDITarget.h
index
cc8c7db
..
55a1a95
100644
(file)
--- a/
Projects/AVRISP/Lib/PDITarget.h
+++ b/
Projects/AVRISP/Lib/PDITarget.h
@@
-39,6
+39,8
@@
/* Includes: */
\r
#include <avr/io.h>
\r
#include <stdbool.h>
\r
/* Includes: */
\r
#include <avr/io.h>
\r
#include <stdbool.h>
\r
+
\r
+ #include <LUFA/Common/Common.h>
\r
\r
/* Defines: */
\r
#define PDIDATA_LINE_PORT PORTB
\r
\r
/* Defines: */
\r
#define PDIDATA_LINE_PORT PORTB
\r
@@
-64,8
+66,12
@@
#define PD_CTRL_REG 2
\r
\r
#define PDI_STATUS_NVM (1 << 1)
\r
#define PD_CTRL_REG 2
\r
\r
#define PDI_STATUS_NVM (1 << 1)
\r
+
\r
#define PDI_RESET_KEY 0x59
\r
#define PDI_RESET_KEY 0x59
\r
+ #define PDI_NVMENABLE_KEY (uint8_t[]){0x12, 0x89, 0xAB, 0x45, 0xCD, 0xD8, 0x88, 0xFF}
\r
\r
\r
+ #define TOGGLE_PDI_CLOCK MACROS{ PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK; \
\r
+ PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK; }MACROE
\r
\r
/* Function Prototypes: */
\r
void PDITarget_SendByte(uint8_t Byte);
\r
\r
/* Function Prototypes: */
\r
void PDITarget_SendByte(uint8_t Byte);
\r
diff --git
a/Projects/AVRISP/Lib/V2Protocol.c
b/Projects/AVRISP/Lib/V2Protocol.c
index
d2e0b16
..
24f2080
100644
(file)
--- a/
Projects/AVRISP/Lib/V2Protocol.c
+++ b/
Projects/AVRISP/Lib/V2Protocol.c
@@
-66,6
+66,7
@@
void V2Protocol_ProcessCommand(void)
case CMD_RESET_PROTECTION:
\r
V2Protocol_ResetProtection();
\r
break;
\r
case CMD_RESET_PROTECTION:
\r
V2Protocol_ResetProtection();
\r
break;
\r
+#if defined(ENABLE_SPI_PROTOCOL)
\r
case CMD_ENTER_PROGMODE_ISP:
\r
ISPProtocol_EnterISPMode();
\r
break;
\r
case CMD_ENTER_PROGMODE_ISP:
\r
ISPProtocol_EnterISPMode();
\r
break;
\r
@@
-83,14
+84,6
@@
void V2Protocol_ProcessCommand(void)
case CMD_CHIP_ERASE_ISP:
\r
ISPProtocol_ChipErase();
\r
break;
\r
case CMD_CHIP_ERASE_ISP:
\r
ISPProtocol_ChipErase();
\r
break;
\r
-#if defined(ENABLE_XPROG_PROTOCOL)
\r
- case CMD_XPROG_SETMODE:
\r
- PDIProtocol_XPROG_SetMode();
\r
- break;
\r
- case CMD_XPROG:
\r
- PDIProtocol_XPROG_Command();
\r
- break;
\r
-#endif
\r
case CMD_READ_FUSE_ISP:
\r
case CMD_READ_LOCK_ISP:
\r
case CMD_READ_SIGNATURE_ISP:
\r
case CMD_READ_FUSE_ISP:
\r
case CMD_READ_LOCK_ISP:
\r
case CMD_READ_SIGNATURE_ISP:
\r
@@
-104,6
+97,15
@@
void V2Protocol_ProcessCommand(void)
case CMD_SPI_MULTI:
\r
ISPProtocol_SPIMulti();
\r
break;
\r
case CMD_SPI_MULTI:
\r
ISPProtocol_SPIMulti();
\r
break;
\r
+#endif
\r
+#if defined(ENABLE_XPROG_PROTOCOL)
\r
+ case CMD_XPROG_SETMODE:
\r
+ PDIProtocol_XPROG_SetMode();
\r
+ break;
\r
+ case CMD_XPROG:
\r
+ PDIProtocol_XPROG_Command();
\r
+ break;
\r
+#endif
\r
default:
\r
V2Protocol_UnknownCommand(V2Command);
\r
break;
\r
default:
\r
V2Protocol_UnknownCommand(V2Command);
\r
break;
\r
diff --git
a/Projects/AVRISP/makefile
b/Projects/AVRISP/makefile
index
cf4fa00
..
d7fe4ac
100644
(file)
--- a/
Projects/AVRISP/makefile
+++ b/
Projects/AVRISP/makefile
@@
-193,6
+193,7
@@
CDEFS += -DRESET_LINE_PORT=PORTB
CDEFS += -DRESET_LINE_DDR=DDRB
\r
CDEFS += -DRESET_LINE_MASK="(1 << 4)"
\r
CDEFS += -DVTARGET_ADC_CHANNEL=2
\r
CDEFS += -DRESET_LINE_DDR=DDRB
\r
CDEFS += -DRESET_LINE_MASK="(1 << 4)"
\r
CDEFS += -DVTARGET_ADC_CHANNEL=2
\r
+CDEFS += -DENABLE_SPI_PROTOCOL
\r
CDEFS += -DENABLE_XPROG_PROTOCOL
\r
\r
\r
CDEFS += -DENABLE_XPROG_PROTOCOL
\r
\r
\r