Calibrate urboot's -xdelay for windows

This commit is contained in:
Stefan Rueger 2022-11-27 13:57:37 +00:00
parent 0e0a0ba0eb
commit 0c96f5d6dc
No known key found for this signature in database
GPG Key ID: B0B4F1FD86B1EC55
3 changed files with 8 additions and 3 deletions

View File

@ -1253,7 +1253,7 @@ frame is programmed.
.It Ar delay=<n> .It Ar delay=<n>
Add a <n> ms delay after reset. This can be useful if a board takes a Add a <n> ms delay after reset. This can be useful if a board takes a
particularly long time to exit from external reset. <n> can be negative, particularly long time to exit from external reset. <n> can be negative,
in which case the default 110 ms delay after issuing reset will be in which case the default 110-140 ms delay after issuing reset will be
shortened accordingly. shortened accordingly.
.It Ar strict .It Ar strict
Urclock has a faster, but slightly different strategy than -c arduino to Urclock has a faster, but slightly different strategy than -c arduino to

View File

@ -1049,7 +1049,7 @@ frame is programmed.
@item @samp{delay=<n>} @item @samp{delay=<n>}
Add a <n> ms delay after reset. This can be useful if a board takes a Add a <n> ms delay after reset. This can be useful if a board takes a
particularly long time to exit from external reset. <n> can be negative, particularly long time to exit from external reset. <n> can be negative,
in which case the default 110 ms delay after issuing reset will be in which case the default 110-140 ms delay after issuing reset will be
shortened accordingly. shortened accordingly.
@item @samp{strict} @item @samp{strict}
Urclock has a faster, but slightly different strategy than -c arduino to Urclock has a faster, but slightly different strategy than -c arduino to

View File

@ -1872,7 +1872,7 @@ static int urclock_recv(const PROGRAMMER *pgm, unsigned char *buf, size_t len) {
rv = serial_recv(&pgm->fd, buf, len); rv = serial_recv(&pgm->fd, buf, len);
if(rv < 0) { if(rv < 0) {
if(!ur.sync_silence) if(!ur.sync_silence)
pmsg_error("programmer is not responding; try and vary -xdelay=100 and/or -xstrict\n"); pmsg_error("programmer is not responding; try -xstrict and/or vary -xdelay=100\n");
return -1; return -1;
} }
@ -2191,8 +2191,13 @@ static int urclock_open(PROGRAMMER *pgm, const char *port) {
// Set DTR and RTS back to high // Set DTR and RTS back to high
serial_set_dtr_rts(&pgm->fd, 1); serial_set_dtr_rts(&pgm->fd, 1);
#ifndef WIN32
if((110+ur.delay) > 0) if((110+ur.delay) > 0)
usleep((110+ur.delay)*1000); // Wait until board comes out of reset usleep((110+ur.delay)*1000); // Wait until board comes out of reset
#else
if((137+ur.delay) > 0)
usleep((137+ur.delay)*1000); // Wait until board starts up accommodating effective drain time
#endif
// Drain any extraneous input // Drain any extraneous input
serial_drain_timeout = 20; // ms serial_drain_timeout = 20; // ms