Fixed AVRISP-MKII clone project not correctly issuing SET EXTENDED ADDRESS commands when the extended address boundary is crossed during programming or readback (thanks to Gerard Sexton).

Fixed warnings when building the AVRISP-MKII clone project with the ENABLE_XPROG_PROTOCOL compile time option disabled.
pull/1469/head
Dean Camera 15 years ago
parent 1331cce08a
commit cd0093a14b

@ -17,6 +17,9 @@
* <b>Fixed:</b> * <b>Fixed:</b>
* - Fixed possible device lockup when INTERRUPT_CONTROL_ENDPOINT is enabled and the control endpoint is not properly * - Fixed possible device lockup when INTERRUPT_CONTROL_ENDPOINT is enabled and the control endpoint is not properly
* selected when the ISR completes * selected when the ISR completes
* - Fixed AVRISP-MKII clone project not correctly issuing SET EXTENDED ADDRESS commands when the extended address
* boundary is crossed during programming or readback (thanks to Gerard Sexton)
* - Fixed warnings when building the AVRISP-MKII clone project with the ENABLE_XPROG_PROTOCOL compile time option disabled
* *
* \section Sec_ChangeLog100512 Version 100512 * \section Sec_ChangeLog100512 Version 100512
* *

@ -227,9 +227,19 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
PollAddress = (CurrentAddress & 0xFFFF); PollAddress = (CurrentAddress & 0xFFFF);
} }
if (IsOddByte || (V2Command == CMD_PROGRAM_EEPROM_ISP)) /* EEPROM just increments the address each byte, flash needs to increment on each word and
* also check to ensure that a LOAD EXTENDED ADDRESS command is issued each time the extended
* address boundary has been crossed */
if (V2Command == CMD_PROGRAM_EEPROM_ISP)
{
CurrentAddress++; CurrentAddress++;
} }
else if (IsOddByte)
{
if (!(++CurrentAddress & 0xFFFF))
ISPTarget_LoadExtendedAddress();
}
}
/* If the current page must be committed, send the PROGRAM PAGE command to the target */ /* If the current page must be committed, send the PROGRAM PAGE command to the target */
if (Write_Memory_Params.ProgrammingMode & PROG_MODE_COMMIT_PAGE_MASK) if (Write_Memory_Params.ProgrammingMode & PROG_MODE_COMMIT_PAGE_MASK)
@ -276,8 +286,18 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
PollAddress = (CurrentAddress & 0xFFFF); PollAddress = (CurrentAddress & 0xFFFF);
} }
if (IsOddByte || (V2Command == CMD_PROGRAM_EEPROM_ISP)) /* EEPROM just increments the address each byte, flash needs to increment on each word and
* also check to ensure that a LOAD EXTENDED ADDRESS command is issued each time the extended
* address boundary has been crossed */
if (V2Command == CMD_PROGRAM_EEPROM_ISP)
{
CurrentAddress++; CurrentAddress++;
}
else if (IsOddByte)
{
if (!(++CurrentAddress & 0xFFFF))
ISPTarget_LoadExtendedAddress();
}
ProgrammingStatus = ISPTarget_WaitForProgComplete(Write_Memory_Params.ProgrammingMode, PollAddress, PollValue, ProgrammingStatus = ISPTarget_WaitForProgComplete(Write_Memory_Params.ProgrammingMode, PollAddress, PollValue,
Write_Memory_Params.DelayMS, Write_Memory_Params.ProgrammingCommands[2]); Write_Memory_Params.DelayMS, Write_Memory_Params.ProgrammingCommands[2]);
@ -347,11 +367,19 @@ void ISPProtocol_ReadMemory(uint8_t V2Command)
if (V2Command == CMD_READ_FLASH_ISP) if (V2Command == CMD_READ_FLASH_ISP)
Read_Memory_Params.ReadMemoryCommand ^= READ_WRITE_HIGH_BYTE_MASK; Read_Memory_Params.ReadMemoryCommand ^= READ_WRITE_HIGH_BYTE_MASK;
/* Only increment the current address if we have read both bytes in the current word when in FLASH /* EEPROM just increments the address each byte, flash needs to increment on each word and
* read mode, or for each byte when in EEPROM read mode */ * also check to ensure that a LOAD EXTENDED ADDRESS command is issued each time the extended
if (((CurrentByte & 0x01) && (V2Command == CMD_READ_FLASH_ISP)) || (V2Command == CMD_READ_EEPROM_ISP)) * address boundary has been crossed */
if (V2Command == CMD_READ_EEPROM_ISP)
{
CurrentAddress++; CurrentAddress++;
} }
else if (CurrentByte & 0x01)
{
if (!(++CurrentAddress & 0xFFFF))
ISPTarget_LoadExtendedAddress();
}
}
Endpoint_Write_Byte(STATUS_CMD_OK); Endpoint_Write_Byte(STATUS_CMD_OK);

@ -68,7 +68,7 @@
bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint16_t WriteLength); bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint16_t WriteLength);
bool TINYNVM_EraseMemory(const uint8_t EraseCommand, const uint16_t Address); bool TINYNVM_EraseMemory(const uint8_t EraseCommand, const uint16_t Address);
#if defined(INCLUDE_FROM_TINYNVM_C) #if (defined(INCLUDE_FROM_TINYNVM_C) && defined(ENABLE_XPROG_PROTOCOL))
static void TINYNVM_SendReadNVMRegister(const uint8_t Address); static void TINYNVM_SendReadNVMRegister(const uint8_t Address);
static void TINYNVM_SendWriteNVMRegister(const uint8_t Address); static void TINYNVM_SendWriteNVMRegister(const uint8_t Address);
static void TINYNVM_SendPointerAddress(const uint16_t AbsoluteAddress); static void TINYNVM_SendPointerAddress(const uint16_t AbsoluteAddress);

@ -119,7 +119,7 @@
void XPROGProtocol_SetMode(void); void XPROGProtocol_SetMode(void);
void XPROGProtocol_Command(void); void XPROGProtocol_Command(void);
#if defined(INCLUDE_FROM_XPROGPROTOCOL_C) #if (defined(INCLUDE_FROM_XPROGPROTOCOL_C) && defined(ENABLE_XPROG_PROTOCOL))
static void XPROGProtocol_EnterXPROGMode(void); static void XPROGProtocol_EnterXPROGMode(void);
static void XPROGProtocol_LeaveXPROGMode(void); static void XPROGProtocol_LeaveXPROGMode(void);
static void XPROGProtocol_SetParam(void); static void XPROGProtocol_SetParam(void);

@ -118,7 +118,7 @@
void XPROGTarget_SendBreak(void); void XPROGTarget_SendBreak(void);
bool XPROGTarget_WaitWhileNVMBusBusy(void); bool XPROGTarget_WaitWhileNVMBusBusy(void);
#if defined(INCLUDE_FROM_XPROGTARGET_C) #if (defined(INCLUDE_FROM_XPROGTARGET_C) && defined(ENABLE_XPROG_PROTOCOL))
static void XPROGTarget_SetTxMode(void); static void XPROGTarget_SetTxMode(void);
static void XPROGTarget_SetRxMode(void); static void XPROGTarget_SetRxMode(void);
#endif #endif

@ -30,7 +30,7 @@
/* Buffer Configuration: */ /* Buffer Configuration: */
/* Buffer length - select static size of created ring buffers: */ /* Buffer length - select static size of created ring buffers: */
#define BUFF_STATICSIZE 128 // Set to the static ring buffer size for all ring buffers (place size after define) #define BUFF_STATICSIZE 255 // Set to the static ring buffer size for all ring buffers (place size after define)
/* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */ /* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */
#define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access #define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access

@ -60,7 +60,7 @@
# MCU name # MCU name
MCU = atmega32u4 MCU = atmega32u2
# Target board (see library "Board Types" documentation, NONE for projects not requiring # Target board (see library "Board Types" documentation, NONE for projects not requiring

Loading…
Cancel
Save