Fix endianness of LOAD_ADDRESS command data, add correct PROGRAM_FLASH_ISP/PROGRAM_EEPROM_ISP polling and endpoint bank clearing, add hardware delays/timeouts to the V2 Protocol handler in the AVRISP project.
This commit is contained in:
parent
8cb8f1cfdd
commit
f070902bdb
4 changed files with 42 additions and 36 deletions
|
@ -83,7 +83,7 @@ void V2Protocol_DelayMS(uint8_t MS)
|
|||
}
|
||||
|
||||
uint8_t V2Protocol_WaitForProgComplete(uint8_t ProgrammingMode, uint16_t PollAddress, uint8_t PollValue,
|
||||
uint8_t DelayMS, bool IsFlashMemory, uint8_t ReadMemCommand)
|
||||
uint8_t DelayMS, uint8_t ReadMemCommand)
|
||||
{
|
||||
uint8_t ProgrammingStatus = STATUS_CMD_OK;
|
||||
|
||||
|
@ -96,12 +96,6 @@ uint8_t V2Protocol_WaitForProgComplete(uint8_t ProgrammingMode, uint16_t PollAdd
|
|||
break;
|
||||
case PROG_MODE_WORD_VALUE_MASK:
|
||||
case PROG_MODE_PAGED_VALUE_MASK:
|
||||
if (IsFlashMemory && (PollAddress & 0x01))
|
||||
{
|
||||
ReadMemCommand |= READ_WRITE_ODD_BYTE_MASK;
|
||||
PollAddress >>= 1;
|
||||
}
|
||||
|
||||
TCNT0 = 0;
|
||||
|
||||
do
|
||||
|
@ -119,6 +113,7 @@ uint8_t V2Protocol_WaitForProgComplete(uint8_t ProgrammingMode, uint16_t PollAdd
|
|||
case PROG_MODE_WORD_READYBUSY_MASK:
|
||||
case PROG_MODE_PAGED_READYBUSY_MASK:
|
||||
ProgrammingStatus = V2Protocol_WaitWhileTargetBusy();
|
||||
break;
|
||||
}
|
||||
|
||||
return ProgrammingStatus;
|
||||
|
@ -126,8 +121,6 @@ uint8_t V2Protocol_WaitForProgComplete(uint8_t ProgrammingMode, uint16_t PollAdd
|
|||
|
||||
uint8_t V2Protocol_WaitWhileTargetBusy(void)
|
||||
{
|
||||
uint8_t ResponseByte;
|
||||
|
||||
TCNT0 = 0;
|
||||
|
||||
do
|
||||
|
@ -136,9 +129,8 @@ uint8_t V2Protocol_WaitWhileTargetBusy(void)
|
|||
SPI_SendByte(0x00);
|
||||
|
||||
SPI_SendByte(0x00);
|
||||
ResponseByte = SPI_ReceiveByte();
|
||||
}
|
||||
while ((ResponseByte & 0x01) && (TCNT0 < TARGET_BUSY_TIMEOUT_MS));
|
||||
while ((SPI_ReceiveByte() & 0x01) && (TCNT0 < TARGET_BUSY_TIMEOUT_MS));
|
||||
|
||||
if (TCNT0 >= TARGET_BUSY_TIMEOUT_MS)
|
||||
return STATUS_RDY_BSY_TOUT;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue