As [Phil Greenland] explains in the first part of his excellent write-up, the lithium battery used to keep the real-time clock (RTC) going on the Macintosh SE/30 has a nasty habit of exploding and leaking its corrosive innards all over the board. Looking to both repair the damage on a system that’s already had a battery popped and avoid the issue altogether on pristine boards, he started researching how he could replace the battery with something a bit more modern.

Damage from a ruptured RTC battery.

It turns out, the ATtiny85 is pin-compatible with the Mac’s original RTC chip, and indeed, [Andrew Makousky] had already written some code that would allow the microcontroller to emulate it. This is actually a bit more complex than you might realize, as the original RTC chip was doing double-duty: it also held 256 bytes of parameter random access memory (PRAM), which is where the machine stored assorted bits of info like which drive to boot from and the mouse cursor speed.

But after getting the mod installed, the computer refused to start. It turns out the project targeted earlier machines like the Macintosh Plus and SE, and not his higher-performance SE/30. Thanks to community resources like this KiCad recreation of the SE/30’s motherboard, contemporary technical documents, and his trusty logic analyzer, [Phil] was able to figure out that the timing was off — the code was simply struggling to respond to the faster machine.

[Phil] got things largely working by pushing a lot of the code off into an interrupt handler, thereby increasing the response time. But it operated on a very fine line, the new code only just got the timing within specs, and occasionally it would drift off and result in an error. It was good enough to get the machine up and running again, but not the long-term solution he’d hoped for.

It’s not until we get to the second part of this retrocomputing adventure that [Phil] finally cracks the case. He realized that the solution to get better performance out of the ATtiny85 was to leverage its universal serial interface (USI), which is generally used for SPI and I2C communications. Luckily, the Apple RTC protocol was close enough to I2C that getting everybody speaking the same language wouldn’t be a problem. The only downside was that he needed to use a different set of pins to pull it off.

In the end, he had to abandon the classic DIP-8 style ATtiny85 and design a tiny custom PCB around the SOIC-8 version. This not only let him route the pins differently, but enabled him to tack on an external crystal oscillator that boasts a bit higher resolution than the chip’s built-in facilities.

We’ve previously seen creative (or just desperate) hackers “re-pin” an ATtiny85 by flipping the leads around and adding bodge wires; a very literal hack that might have also worked here. But we think the custom PCB was worth the extra effort to produce a permanent drop-in solution that other Mac SE/30 owners can benefit from. After all, what some consider the best computer ever made deserves no less.

Source: https://hackaday.com/2023/01/13/swap-the-clock-chip-on-the-mac-se-30-with-an-attiny85/