phi2 is a collection of breadboard-buildable, highly-flexible, clock generators for retro/homebrew computers, using a minimal number of inexpensive and readily available micro-controllers, SBCs and other parts.
This is a reference to the clock input on my favorite early CPU/MPU, the 6502. While 6502-based builds are my current focus, the clock generators here can be used with effectively any CPU/computer build.
A simple mono-repo, with sub-projects on a per-build basis.
Due to the typically resource-constrained nature of the smaller microcontrollers, and significant differences between architectures and, even within a common architecture, different capabilities and pin-outs, shared code is likely to be limited. Thus each project may be considered a self-contained whole, unless otherwise noted. This helps minimize code size and complexity and improves code readability by avoiding the otherwise-necessary multiple levels of conditional compilation that would otherwise be required.
Each individual project will include both hardware build details and diagrams along with ready-to-run firmware/software.
These will vary per-project.
This is the first project in the series.
It has single-step and clock modes, run-stop toggle, selectable frequencies across three bands (Hz, kHz and MHz) in various increments from 1Hz to 8MHz, auto and manual reset functionality (with auto-reset on start option, configurable at run-time), a 14-segment 4-character LED status/info display (in keeping with the "retro" theme) with brightness control and run-time indicators. This is a simple build, using just an Arduino Nano (an inexpensive clone will work fine) and four tactile buttons.
Advanced variations of this will incorporate different display technologies including tiny OLED and TFT color displays, and rich menu/graphical interfaces.
This 2nd, and almost the simplest (just the core capabilities), "phi2" project provides run-time selectable (and saveable) 1MHz, 2MHz, 4MHz and 8MHz clock frequencies, auto-starts when powered on, and offers a compile-time flag to enable/disable auto-reset behavior, and indicates operations using the built-in Arduino LED. It requires only an Arduino Nano (or clone) and a single tactile button, which can be removed once an operating frequency has been selected and saved.
nano-clock-core is not much bigger than a standard 4-pin crystal oscillator can.
The third clock build in the "phi2" series, and to date the simplest, departs from the typical "Arduino Board" based model and instead makes direct use of a "raw" microcontroller; in this case the ATtiny85.
The simplest build is just the ATTiny85 IC itself, an 8-pin DIP part that is smaller than the 4-pin crystal oscillator can in the standard BE6502 setup. Optional, basic components (1 or 2 tactile buttons, and/or 1 resistor and LED), expand the basic clock generator behavior with run-time selectable (and saveable) 1MHz, 2MHz, 4MHz and 8MHz clock frequencies, an LED to indicate clock state/speed, and a single-step clock mode.
Settings can be saved by adding a button temporarily, and then can be removed.
None for these projects, unless noted otherwise.
The goal wasn't to build them quickly, it was to have fun doing so and learn as much about the low-level hardware as possible. That often means hand-optimized coding based on information buried deep in the datasheets for the raw microcontroller cores.
In most cases it also required a fair degree of manual tuning, changing values on the fly while observing output performance across several physical devices on a high-speed oscilloscope. Variations within quoted tolerance are readily visible here.


