|
6 | 6 | // Version 1.1: Output an 8 MHz clock on pin 9
|
7 | 7 | // Version 1.2: Corrected flash size for Atmega1284P.
|
8 | 8 | // Version 1.3: Added signatures for ATtiny2313A, ATtiny4313, ATtiny13
|
| 9 | +// Version 1.4: Added signature for Atmega8A |
| 10 | +// Fixed bug in displaying bootloader size |
9 | 11 |
|
10 | 12 | /*
|
11 | 13 |
|
@@ -103,13 +105,16 @@ char PROGMEM descSelfProgrammingEnable [] = "Self Programming Enable";
|
103 | 105 | char PROGMEM descHardwareBootEnable [] = "Hardare Boot Enable";
|
104 | 106 | char PROGMEM descOCDEnable [] = "OCD Enable";
|
105 | 107 | char PROGMEM descJtagEnable [] = "JTAG Enable";
|
| 108 | +char PROGMEM descOscillatorOptions [] = "Oscillator Options"; |
| 109 | +char PROGMEM descBrownOutDetectorEnable [] = "Brown out detector enable"; |
| 110 | +char PROGMEM descBrownOutDetectorLevel [] = "Brown out detector level"; |
106 | 111 |
|
107 | 112 | // calculate size of bootloader
|
108 | 113 | void fBootloaderSize (const byte val, const unsigned int bootLoaderSize)
|
109 | 114 | {
|
110 | 115 | Serial.print (F("Bootloader size: "));
|
111 | 116 | unsigned int len = bootLoaderSize;
|
112 |
| - switch (val >> 1) |
| 117 | + switch (val & 3) |
113 | 118 | {
|
114 | 119 | case 0: len *= 8; break;
|
115 | 120 | case 1: len *= 4; break;
|
@@ -185,6 +190,23 @@ void fClockSource (const byte val, const unsigned int bootLoaderSize)
|
185 | 190 | } // end of switch
|
186 | 191 |
|
187 | 192 | } // end of fClockSource
|
| 193 | + |
| 194 | +// work out clock source (Atmega8A) |
| 195 | +void fClockSource2 (const byte val, const unsigned int bootLoaderSize) |
| 196 | + { |
| 197 | + Serial.print (F("Clock source: ")); |
| 198 | + switch (val) |
| 199 | + { |
| 200 | + case 0b1010 ... 0b1111: Serial.println (F("low-power crystal.")); break; |
| 201 | + case 0b1001 : Serial.println (F("low-frequency crystal.")); break; |
| 202 | + case 0b0101 ... 0b1000: Serial.println (F("external RC oscillator.")); break; |
| 203 | + case 0b0001 ... 0b0100: Serial.println (F("calibrated internal oscillator.")); break; |
| 204 | + case 0b0000: Serial.println (F("external clock.")); break; |
| 205 | + default: Serial.println (F("reserved.")); break; |
| 206 | + } // end of switch |
| 207 | + |
| 208 | + } // end of fClockSource2 |
| 209 | + |
188 | 210 |
|
189 | 211 | // fuses for various processors
|
190 | 212 |
|
@@ -338,6 +360,26 @@ fuseMeaning PROGMEM ATtiny13_fuses [] =
|
338 | 360 | { highFuse, 0x06, NULL, fBrownoutDetectorLevel },
|
339 | 361 |
|
340 | 362 | }; // end of ATtiny13_fuses
|
| 363 | + |
| 364 | +fuseMeaning PROGMEM ATmega8_fuses [] = |
| 365 | + { |
| 366 | + { highFuse, 0x80, descExternalResetDisable }, |
| 367 | + { highFuse, 0x40, descWatchdogTimerAlwaysOn }, |
| 368 | + { highFuse, 0x20, descSelfProgrammingEnable }, |
| 369 | + { highFuse, 0x10, descOscillatorOptions }, |
| 370 | + { highFuse, 0x80, descEEPROMsave }, |
| 371 | + { highFuse, 0x01, descBootIntoBootloader }, |
| 372 | + |
| 373 | + { lowFuse, 0x80, descBrownOutDetectorLevel }, |
| 374 | + { lowFuse, 0x40, descBrownOutDetectorEnable }, |
| 375 | + |
| 376 | + // special (combined) bits |
| 377 | + { highFuse, 0x06, NULL, fBootloaderSize }, |
| 378 | + |
| 379 | + { lowFuse, 0x30, NULL, fStartUpTime }, |
| 380 | + { lowFuse, 0x0F, NULL, fClockSource2 }, |
| 381 | + |
| 382 | + }; // end of ATmega8_fuses |
341 | 383 |
|
342 | 384 | // structure for information about a single processor
|
343 | 385 | typedef struct {
|
@@ -399,6 +441,9 @@ const signatureType signatures [] =
|
399 | 441 | // ATtiny13 family
|
400 | 442 | { { 0x1E, 0x90, 0x07 }, "ATtiny13A", 1 * kb, 0, ATtiny13_fuses, NUMITEMS (ATtiny13_fuses) },
|
401 | 443 |
|
| 444 | + // Atmega8A family |
| 445 | + { { 0x1E, 0x93, 0x07 }, "ATmega8A", 8 * kb, 256, ATmega8_fuses, NUMITEMS (ATmega8_fuses) }, |
| 446 | + |
402 | 447 | }; // end of signatures
|
403 | 448 |
|
404 | 449 | // if signature found in above table, this is its index
|
|
0 commit comments