* ranges are specified (thanks to Thomas Bleeker)\r
* - Fixed CDC and RNDIS host demos and class drivers - bidirectional endpoints should use two seperate pipes, not one half-duplex pipe\r
* - Fixed Pipe_IsEndpointBound() not taking the endpoint's direction into account\r
+ * - Fixed EEPROM and FLASH ISP programming in the AVRISP project\r
*\r
* \section Sec_ChangeLog091223 Version 091223\r
*\r
\r
/* AVR FLASH addressing requires us to modify the write command based on if we are writing a high\r
* or low byte at the current word address */\r
- Write_Memory_Params.ProgrammingCommands[0] ^= READ_WRITE_HIGH_BYTE_MASK;\r
+ if (V2Command == CMD_PROGRAM_FLASH_ISP)\r
+ Write_Memory_Params.ProgrammingCommands[0] ^= READ_WRITE_HIGH_BYTE_MASK;\r
\r
/* Check to see the write completion method, to see if we have a valid polling address */\r
if (!(PollAddress) && (ByteToWrite != PollValue))\r
{\r
if (IsOddByte && (V2Command == CMD_PROGRAM_FLASH_ISP))\r
Write_Memory_Params.ProgrammingCommands[2] |= READ_WRITE_HIGH_BYTE_MASK;\r
- \r
+\r
PollAddress = (CurrentAddress & 0xFFFF); \r
} \r
\r
{\r
bool IsOddByte = (CurrentByte & 0x01);\r
uint8_t ByteToWrite = *(NextWriteByte++);\r
- \r
- if (IsOddByte && (V2Command == CMD_READ_FLASH_ISP))\r
- Write_Memory_Params.ProgrammingCommands[0] |= READ_WRITE_HIGH_BYTE_MASK;\r
- else\r
- Write_Memory_Params.ProgrammingCommands[0] &= ~READ_WRITE_HIGH_BYTE_MASK; \r
\r
SPI_SendByte(Write_Memory_Params.ProgrammingCommands[0]);\r
SPI_SendByte(CurrentAddress >> 8);\r
SPI_SendByte(CurrentAddress & 0xFF);\r
SPI_SendByte(ByteToWrite);\r
\r
+ /* AVR FLASH addressing requires us to modify the write command based on if we are writing a high\r
+ * or low byte at the current word address */\r
+ if (V2Command == CMD_PROGRAM_FLASH_ISP)\r
+ Write_Memory_Params.ProgrammingCommands[0] ^= READ_WRITE_HIGH_BYTE_MASK;\r
+\r
if (ByteToWrite != PollValue)\r
{\r
if (IsOddByte && (V2Command == CMD_PROGRAM_FLASH_ISP))\r
SPI_SendByte(PollAddress >> 8);\r
SPI_SendByte(PollAddress & 0xFF);\r
}\r
- while ((SPI_TransferByte(0x00) != PollValue) && TimeoutMSRemaining);\r
+ while ((SPI_TransferByte(0x00) == PollValue) && TimeoutMSRemaining);\r
\r
if (!(TimeoutMSRemaining))\r
ProgrammingStatus = STATUS_CMD_TOUT;\r