Fix stk500 page write (Program Page command). This is supported after

all on non-paged-memory parts.  The problem was that the page size was
defaulting to 256 (maximum for the stk500), but the timeout for a
response from the stk500 before declaring it dead was only 0.5
seconds.  But it takes much longer than 0.5 seconds to program 256
bytes, so we just weren't waiting long enough.

Fix this in two ways - increase the timeout to 5 seconds, and decrease
the page size to 16 bytes for non-paged parts.  The programming time
for 16 bytes is short enough to provide the user with some feedback
that something is happening.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@260 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Brian S. Dean
2003-03-05 04:30:20 +00:00
parent a61708b2b9
commit db1fd5124e
2 changed files with 18 additions and 24 deletions

View File

@@ -109,8 +109,8 @@ static int stk500_recv(PROGRAMMER * pgm, char * buf, int n)
int nfds;
int rc;
timeout.tv_sec = 0;
timeout.tv_usec = 500000;
timeout.tv_sec = 5;
timeout.tv_usec = 0;
while (n) {
FD_ZERO(&rfds);
@@ -511,6 +511,8 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
retry:
tries++;
memset(buf, 0, sizeof(buf));
/*
* set device programming parameters
*/
@@ -879,9 +881,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
unsigned int n;
if (page_size == 0) {
fprintf(stderr, "%s: stk500_paged_write(): invalid page size = %d\n",
progname, page_size);
return -1;
page_size = 16;
}
if (strcmp(m->desc, "flash") == 0) {