This project actually began in the fall of 2019. I needed to learn verilog for an internship (they only taught me VHDL in school), and so I was messing around with a couple different FPGA dev boards (Terasic DE10-Lite, and the TinyFPGA AX2). Eventually I figured it would be fun to try and make a PCB with an FPGA on it, since I'd never done that before.
Since I didn't want to just make a dev board I needed a project, and I thought it would be cool to try and make a freestanding digital real time clock.
- freestanding: contains its own oscillator and does not rely on an external time source or synchronization signal like the utility frequency or GPS
- digital: since I am not clickspring :(
- Real Time Clock: should have a friendly display that I can show to normal people and say "this is a clock that I made"
I also had some other requirements:
- should be more accurate than the quoted accuracy of my Casio wristwatch (better than +/- 30 s/mo, or ~12ppm for a standard issue 30 day month)
- should show off lots of hire-able skills (ended up signing up for grad school instead... whoops)
In order to meet these objectives I came up with the following architecture:
This is the ticking heart of the clock. It would be cool to build my own very accurate oscillator, but that's a project unto itself. It would also be cool to use a surplus rubidium frequency standard as the master oscillator, but that would also be a bit of an undertaking. Therefore to keep things simple (for now) I decided to use a prebuilt oscillator module (more discussion about the specific part later). However, I'd like to keep the counting logic oscillator agnostic, in order to ensure that its easy to swap out the oscillator at a later date.
every tick of the oscillator needs to be counted, and every 1/f ticks the counting logic should increment a seconds register. This is the FPGA part of this project.
Could I compute time and date from a seconds register, drive a display, read some buttons, and deal with a UART/USB connection from an FPGA? yeah probably. Do I want to? not particularly. Therefore all of these tasks will be carried out by a microcontroller.
should be something nice and friendly to read, preferably with some flexibility since I want to display strings like:
"PST: 19:32.57, 12 NOV 2022"
in a way that doesn't require learning how to decode an array of blinking LEDs.
Finally I need a way to set the time that the clock displays. Since the Time computation is going to be handled in a microcontroller, the set reset interface needs to talk to the microcontroller. I decided that the easiest way to set the time would be over a USB serial port since then I could write a little utility that would synchronize the clock to current time of the computer that its plugged into.
In the next post I'll talk about the parts I picked, and the version 1 hardware design.