Close

Initial design

A project log for GPS Talking Clock

Accurate time without a display

nick-sayerNick Sayer 01/02/2018 at 17:010 Comments

The PDF of the initial schematic has been uploaded to the files section. The first page is very similar to the most recent design of the GPS clock - the XMega32E5 and its connection to the GPS module is the same.

The second page is almost entirely different. There we have the SD card, which is connected to the SPI bus on port C. Instead of the display, the DAC output on port A and the OC5A pin on port D are fed into an audio mixing arrangement (with a low-pass filter on the timer output) and then into an audio amplifier. The audio amp can be turned on and off under software control, with the pushbutton being another input into the controller. This allows the button to have different behaviors defined in software.

I've added a couple of diagnostic LEDs to the circuit to aid in software development. Their exact purpose is TBD.

The software development hasn't started yet, but already it's clear that timer 4 will be set up to run at 8 kHz and act as a DMA clock for sending the audio to the DAC. Timer 5 will be set up to run at 2 kHz and toggle OC5A whenever it runs out. That will generate a nominal 1 kHz output. The actual output pin will be turned on and off in software. It will be turned on at the start of the PPS ISR, and then turned off in the main loop either 50 ms past the second or 500 ms past the second (depending on whether the second is an even multiple of 10).

The audio system will be double-buffered with two 512 byte buffers. Since we're going to use Petit FFS, we're not going to gain any benefit from using DMA to read from the SD card, since it has a synchronous calling structure, so the DMA ISR that switches the DAC to the other buffer (or stops on completion) will set a flag to tell the main loop to fill the other buffer.

The PPS ISR will have several outputs that it fills for the main loop - the time for the next 10 second block, the current second's place within the block (second 0-9), the captured value of timer 4 (so the main loop can calculate when to turn off the 1 kHz output), and a flag indicating it took place.

The main loop will check to see if it's time to turn off the 1 kHz output, then see if it's time to fill an audio buffer from the SD card, then see if the PPS ISR has been triggered or not. If it has been, and if it's second 1, 5, 6 or 7 of the block, then it will open the appropriate SD card file and set up the audio playback for it (reading the first block and configuring the DMA transfer for it). If none of that has happened, then the button will be polled to check its status and appropriate actions taken.

Discussions