14
14
// Version 1.8: Made dates in file list line up. Omit date/time if default (unknown) date used.
15
15
// Added "L" command (list directory)
16
16
// Version 1.9: Ensure in programming mode before access flash (eg. if reset removed to test)
17
+ // Added reading of clock calibration byte (note: this cannot be changed)
17
18
18
19
/*
19
20
53
54
54
55
// #include <memdebug.h>
55
56
56
- const char Version [] = " 1.8 " ;
57
+ const char Version [] = " 1.9 " ;
57
58
58
59
// bit banged SPI pins
59
60
const byte MSPIM_SCK = 4 ; // port D bit 4
@@ -118,14 +119,15 @@ enum {
118
119
SdFat sd;
119
120
120
121
// copy of fuses/lock bytes found for this processor
121
- byte fuses [4 ];
122
+ byte fuses [5 ];
122
123
123
124
// meaning of bytes in above array
124
125
enum {
125
126
lowFuse,
126
127
highFuse,
127
128
extFuse,
128
- lockByte
129
+ lockByte,
130
+ calibrationByte
129
131
};
130
132
131
133
// structure to hold signature and other relevant data about each chip
@@ -237,6 +239,7 @@ enum {
237
239
programAcknowledge = 0x53 ,
238
240
239
241
readSignatureByte = 0x30 ,
242
+ readCalibrationByte = 0x38 ,
240
243
241
244
readLowFuseByte = 0x50 , readLowFuseByteArg2 = 0x00 ,
242
245
readExtendedFuseByte = 0x50 , readExtendedFuseByteArg2 = 0x08 ,
@@ -805,6 +808,7 @@ void getFuseBytes ()
805
808
fuses [highFuse] = program (readHighFuseByte, readHighFuseByteArg2);
806
809
fuses [extFuse] = program (readExtendedFuseByte, readExtendedFuseByteArg2);
807
810
fuses [lockByte] = program (readLockByte, readLockByteArg2);
811
+ fuses [calibrationByte] = program (readCalibrationByte);
808
812
809
813
Serial.print (F (" LFuse = " ));
810
814
showHex (fuses [lowFuse], true );
@@ -814,16 +818,19 @@ void getFuseBytes ()
814
818
showHex (fuses [extFuse], true );
815
819
Serial.print (F (" Lock byte = " ));
816
820
showHex (fuses [lockByte], true );
821
+ Serial.print (F (" Clock calibration = " ));
822
+ showHex (fuses [calibrationByte], true );
817
823
} // end of getFuseBytes
818
824
819
825
void showFuseName (const byte which)
820
826
{
821
827
switch (which)
822
828
{
823
- case lowFuse: Serial.print (F (" low" )); break ;
824
- case highFuse: Serial.print (F (" high" )); break ;
825
- case extFuse: Serial.print (F (" extended" )); break ;
826
- case lockByte: Serial.print (F (" lock" )); break ;
829
+ case lowFuse: Serial.print (F (" low" )); break ;
830
+ case highFuse: Serial.print (F (" high" )); break ;
831
+ case extFuse: Serial.print (F (" extended" )); break ;
832
+ case lockByte: Serial.print (F (" lock" )); break ;
833
+ case calibrationByte: Serial.print (F (" clock" )); break ;
827
834
} // end of switch
828
835
} // end of showFuseName
829
836
0 commit comments