RTC: Program fuse bits from C source.

This commit is contained in:
Andrew Makousky 2020-09-17 02:46:49 -05:00
parent c4d34dae71
commit 745d73b98a
2 changed files with 24 additions and 3 deletions

View File

@ -34,6 +34,19 @@
#include <avr/interrupt.h>
#include <avr/sleep.h>
/* Fuse bit programming. */
#if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || \
defined(__AVR_ATtiny85__)
FUSES = {
// Use 8 MHz internal clock, not default 1 MHz internal clock.
.low = (LFUSE_DEFAULT | ~FUSE_CKDIV8),
// Disable the external RESET pin since it is used for the 1-second
// interrupt output.
.high = (HFUSE_DEFAULT & FUSE_RSTDISBL),
.extended = EFUSE_DEFAULT,
};
#endif
/********************************************************************/
// Simplified Arduino.h definitions.
typedef enum { false, true } bool; // Compatibility with C++.

View File

@ -9,11 +9,19 @@ unfortunately cannot be used (efficiently/effectively) by the
ATTiny85.
The AVR core clock is run from an internal oscillator to generate 8
MHz, so set the fuse bits accordingly when programming. See the
source code of MacRTC.c for more information on electrical
specifications and the like.
MHz. The required fuse bytes setting is included in the generated ELF
object file in the `.fuse` section, in the order (low, high,
extended). See the source code of MacRTC.c for more information on
electrical specifications and the like.
Reference source, Visited 2020-08-05:
* https://www.reddit.com/r/VintageApple/comments/91e5cf/couldnt_find_a_replacement_for_the_rtcpram_chip/e2xqq60/
* https://pastebin.com/baPZ4nN4
## Device Programming
Please note: For the ATTiny85 form factor, the external RESET pin must
be disabled since it is used for the 1-second interrupt output.
Therefore, after the initial programming, it will only be possible to
reprogram via high-voltage serial programming.