uisp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Uisp-dev] Two minor STK500 bugfixes


From: Terran Melconian
Subject: [Uisp-dev] Two minor STK500 bugfixes
Date: Sat, 31 Jan 2004 02:34:49 -0500

One fixes logic error in the board oscillator setup which I submitted
previously.  The other is a fix for reading the oscillator calibration
byte - I don't properly understand it, but I stole the magic number
from avrdude (the other programmer I use), and it works.

After this fix, UISP is fully working on the fuse, lock, and
calibration bytes for me with an ATMega163 in both serial and parallel
modes.  Thanks for all the hard work!

diff -u -r1.25 Stk500.C
--- Stk500.C    17 Oct 2003 17:26:42 -0000      1.25
+++ Stk500.C    31 Jan 2004 07:28:44 -0000
@@ -506,7 +506,7 @@
 
 TByte TStk500::ReadCalFuseBits(int addr)
 {
-  TByte cmd[] = { 0xc8, 0x00, addr, 0x00 };
+  TByte cmd[] = { 0x38, 0x00, addr, 0x00 };
 
   return UniversalCmd(cmd);
 }
@@ -890,10 +890,7 @@
 
           setfreq=clockbase/clockscale[p]/(n+1.0);
 
-          if (p > 1)
-              sc=0xff;
-          else
-              sc=(int)(8000000/setfreq) - 1;
+          sc = 8000000/setfreq-1 > 0xff ? 0xff : (int)(8000000/setfreq)-1;
 
           printf ("Setting oscillator frequency to %.8g (p=%d,n=%d,sc=%d)\n",
                   setfreq, p, n, sc);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]