Skip to content

Commit ced237b

Browse files
committed
Force reset pin high for 100ms before the prog. session
1 parent baddba9 commit ced237b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/linuxgpio.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,15 @@ static int linuxgpio_sysfs_open(PROGRAMMER *pgm, const char *port) {
292292
}
293293
}
294294

295+
// Set RESET pin high for 100ms before starting the programming session.
296+
// This makes sure the target is in a known "good" condition before
297+
// pulling the reset line down and starting the programming session
298+
int reset_pin = pgm->pinno[PIN_AVR_RESET] & PIN_MASK;
299+
if(reset_pin <= PIN_MAX && my.sysfs_fds[reset_pin] >= 0) {
300+
pgm->setpin(pgm, reset_pin, 1);
301+
usleep(GPIO_SYSFS_OPEN_DELAY);
302+
}
303+
295304
return (0);
296305
}
297306

0 commit comments

Comments
 (0)