Skip to content

Commit e025d7f

Browse files
authored
Update isp.c
Relabelled
1 parent 34744a6 commit e025d7f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

isp.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,16 +224,17 @@ ISP_CONTROL_PORT&=~(1<<ISP_CONTROL_SCK); // Low to start
224224

225225
ISP_CONTROL_DDR&=~(1<<ISP_CONTROL_MISO); // MISO as input
226226
ISP_CONTROL_PORT&=~(1<<ISP_CONTROL_MISO); // No pullup (?)
227+
//ISP_CONTROL_PORT|=(1<<ISP_CONTROL_MISO); // pullup (?)
227228

228229
ISP_CONTROL_DDR|=(1<<ISP_CONTROL_MOSI); // MOSI as output
229230
ISP_CONTROL_PORT&=~(1<<ISP_CONTROL_MOSI); // Low to start
230231

231232
uint8_t tries=0;
232233
while (TRUE) {
233234
delay_ms(50);
234-
ISP_CONTROL_PORT|=(1<<ISP_SPI_SEL_CS); // Positive pulse on RESET now that SCK is clean (ATMega328p datasheet 25.8.2)
235+
ISP_SEL_PORT|=(1<<ISP_SPI_SEL_CS); // Positive pulse on RESET now that SCK is clean (ATMega328p datasheet 25.8.2)
235236
delay_ms(2); // At least 2 clock cycles (AtMega8 datasheet)
236-
ISP_CONTROL_PORT&=~(1<<ISP_SPI_SEL_CS);
237+
ISP_SEL_PORT&=~(1<<ISP_SPI_SEL_CS);
237238
delay_ms(40); // >20 ms required (AtMega8 datasheet)
238239

239240
sendByte(0xAC);
@@ -256,7 +257,7 @@ return FALSE; // SUCCESS
256257
void ISPquiescent() {
257258

258259
// Tristate everything - inputs without pullups
259-
// Target device will only reset if it has its own pull up circuit on reset.
260+
// Target device will only exit reset if it has its own pull up circuit on reset.
260261
// But it probably wouldn't work anyway if it didn't
261262

262263
ISP_CONTROL_DDR&=~(1<<ISP_CONTROL_SCK);
@@ -267,8 +268,9 @@ ISP_SEL_DDR&=~(1<<ISP_SPI_SEL_CS);
267268
ISP_CONTROL_PORT&=~(1<<ISP_CONTROL_SCK);
268269
ISP_CONTROL_PORT&=~(1<<ISP_CONTROL_MISO);
269270
ISP_CONTROL_PORT&=~(1<<ISP_CONTROL_MOSI);
270-
ISP_SEL_PORT&=~(1<<ISP_SPI_SEL_CS);
271+
272+
ISP_SEL_PORT&=~(1<<ISP_SPI_SEL_CS); // Reset is active low. Tristate, No pullup.
271273

272274
ISP_state=ISP_QUIESCENT;
273275
}
274-
#endif
276+
#endif

0 commit comments

Comments
 (0)