uint8_t ResponseStatus = STATUS_CMD_FAILED;\r
\r
CurrentAddress = 0;\r
+ \r
+ /* Set up the synchronous USART to generate the recovery clock on XCK pin */\r
+ UBRR1 = (F_CPU / 500000UL);\r
+ UCSR1B = (1 << TXEN1);\r
+ UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);\r
+ DDRD |= (1 << 5);\r
\r
+ /* Perform execution delay, initialize SPI bus */\r
ISPProtocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS); \r
SPI_Init(ISPTarget_GetSPIPrescalerMask() | SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING | SPI_MODE_MASTER);\r
\r
SPI_ShutDown();\r
ISPProtocol_DelayMS(Leave_ISP_Params.PostDelayMS);\r
\r
+ /* Turn off the synchronous USART to terminate the recovery clock on XCK pin */\r
+ UBRR1 = (F_CPU / 500000UL);\r
+ UCSR1B = (1 << TXEN1);\r
+ UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);\r
+ DDRD &= ~(1 << 5);\r
+\r
Endpoint_Write_Byte(CMD_LEAVE_PROGMODE_ISP);\r
Endpoint_Write_Byte(STATUS_CMD_OK);\r
Endpoint_ClearIN();\r