From ced237ba5329df4141a78f452feb857ed2df2bbb Mon Sep 17 00:00:00 2001 From: MCUdude Date: Thu, 1 May 2025 23:16:46 +0200 Subject: [PATCH] Force reset pin high for 100ms before the prog. session --- src/linuxgpio.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/linuxgpio.c b/src/linuxgpio.c index 0a894de7..c408138c 100644 --- a/src/linuxgpio.c +++ b/src/linuxgpio.c @@ -292,6 +292,15 @@ static int linuxgpio_sysfs_open(PROGRAMMER *pgm, const char *port) { } } + // Set RESET pin high for 100ms before starting the programming session. + // This makes sure the target is in a known "good" condition before + // pulling the reset line down and starting the programming session + int reset_pin = pgm->pinno[PIN_AVR_RESET] & PIN_MASK; + if(reset_pin <= PIN_MAX && my.sysfs_fds[reset_pin] >= 0) { + pgm->setpin(pgm, reset_pin, 1); + usleep(GPIO_SYSFS_OPEN_DELAY); + } + return (0); }