diff options
author | Dean Camera <[email protected]> | 2010-02-10 04:02:10 +0000 |
---|---|---|
committer | Dean Camera <[email protected]> | 2010-02-10 04:02:10 +0000 |
commit | ab195ab1da1da75a3a23d47b56c66d14803a9de3 (patch) | |
tree | 5321c68bf3cc4a81c8f45b125cd5c12dc007223d /Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c | |
parent | 35a0fe93848cc6e1a79d2e606a2e3f6a84ba5755 (diff) | |
download | qmk_firmware-ab195ab1da1da75a3a23d47b56c66d14803a9de3.tar.gz qmk_firmware-ab195ab1da1da75a3a23d47b56c66d14803a9de3.zip |
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.
Diffstat (limited to 'Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c')
-rw-r--r-- | Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c index 33ccbf91e4..e0eb44107b 100644 --- a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c +++ b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c @@ -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();
|