uisp-dev
[Top][All Lists]
Advanced

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

[Uisp-dev] How to handle additional calibration bytes?


From: Terran Melconian
Subject: [Uisp-dev] How to handle additional calibration bytes?
Date: Fri, 23 Jul 2004 23:45:01 -0400

Some of the new ATMega devices now have four oscillator calibration
bytes, for 1, 2, 4, and 8 MHz.  I'd like to extend UISP to support
these.

I thought we could mark the devices which have the extended
information with a new flag such as AVR_CAL_EXT.  The actual code to
fetch the other bytes seems straightforward.  For the Stk500, for
example, in addition to calling ReadCalFuseBits(0), we can call
ReadCalFuseBits(n) where n is between 0 and 3.

The problem is in passing these values back to the code which actually
displays them.  that Main.C uses the device->ReadByte call which is
defined to return a single byte.  I see three possible solutions:

    1. Change the ReadByte call to something more general which can
       return multiple bytes. This would be a major interface change.

    2. When checking the calibration byte in main(), explicitly use
       TestFeatures() to see if there are 0, 1, or 4 bytes.  The
       problem with this is that there are no other calls to
       TestFeatures() there, and it seems to break a level of
       abstraction.

    3. Always query four bytes, and have them return FF if they are
       unsupported, like is done now when querying a single byte on a
       device which doesn't have it.

None of those solutions are obviously correct to me, which is why I'm
sending this long discussion instead of a patch.  If you tell me which
way to go - one of these or something else entirely -  I'd be happy to
implement it.




reply via email to

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