From 277e1a1e7a08325369e7fef7fe4bcd462b888098 Mon Sep 17 00:00:00 2001 From: Jan-Hinnerk Reichert Date: Sun, 4 Jul 2004 12:13:02 +0000 Subject: [PATCH] stk500.c: Fixed fosc behaviour for values exceeding maximum frequency (contributed by Galen Seitz) git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@422 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/ChangeLog | 4 ++++ avrdude/stk500.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog index 58d33bb2..4343b9fa 100644 --- a/avrdude/ChangeLog +++ b/avrdude/ChangeLog @@ -1,3 +1,7 @@ +2004-07-04 Jan-Hinnerk Reichert + * stk500.c: Fixed fosc behaviour for values exceeding + maximum frequency (contributed by Galen Seitz) + 2004-07-04 Jan-Hinnerk Reichert * avrdude.conf.in: Added support for ATtiny2313 (contributed by Bob Paddock) diff --git a/avrdude/stk500.c b/avrdude/stk500.c index dba06a85..ff232fda 100644 --- a/avrdude/stk500.c +++ b/avrdude/stk500.c @@ -919,7 +919,7 @@ static int stk500_set_fosc(PROGRAMMER * pgm, double v) if (fosc >= fbase / (256 * ps[idx] * 2)) { /* this prescaler value can handle our frequency */ prescale = idx + 1; - cmatch = (unsigned)(fbase / (2 * v * ps[idx])); + cmatch = (unsigned)(fbase / (2 * fosc * ps[idx])) - 1; break; } }