Added .5MHz recovery clock to the AVRISP programmer project when in ISP programming mode to correct mis-set fuses.
Fixed AVRISP project not extending the command delay after each successful page/word/byte program.
This commit is contained in:
parent
35a0fe9384
commit
ab195ab1da
6 changed files with 45 additions and 14 deletions
|
@ -62,7 +62,14 @@ void ISPProtocol_EnterISPMode(void)
|
|||
uint8_t ResponseStatus = STATUS_CMD_FAILED;
|
||||
|
||||
CurrentAddress = 0;
|
||||
|
||||
/* Set up the synchronous USART to generate the recovery clock on XCK pin */
|
||||
UBRR1 = (F_CPU / 500000UL);
|
||||
UCSR1B = (1 << TXEN1);
|
||||
UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
|
||||
DDRD |= (1 << 5);
|
||||
|
||||
/* Perform execution delay, initialize SPI bus */
|
||||
ISPProtocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS);
|
||||
SPI_Init(ISPTarget_GetSPIPrescalerMask() | SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING | SPI_MODE_MASTER);
|
||||
|
||||
|
@ -118,6 +125,12 @@ void ISPProtocol_LeaveISPMode(void)
|
|||
SPI_ShutDown();
|
||||
ISPProtocol_DelayMS(Leave_ISP_Params.PostDelayMS);
|
||||
|
||||
/* Turn off the synchronous USART to terminate the recovery clock on XCK pin */
|
||||
UBRR1 = (F_CPU / 500000UL);
|
||||
UCSR1B = (1 << TXEN1);
|
||||
UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
|
||||
DDRD &= ~(1 << 5);
|
||||
|
||||
Endpoint_Write_Byte(CMD_LEAVE_PROGMODE_ISP);
|
||||
Endpoint_Write_Byte(STATUS_CMD_OK);
|
||||
Endpoint_ClearIN();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue