
This chip is the digital core of a guitar pedal: all of the effects, the controls and the audio clocking. Around it you add an audio ADC and DAC (an I2S codec pair), an analog front end, switches, and optionally knobs and an SPI PSRAM for the delay. No microcontroller or firmware is needed: the chip generates every audio clock itself.
Signal path. Guitar -> preamp -> ADC -> chip -> DAC -> output level ->
amp. The chip is the I2S master: it outputs MCLK (= clk, 24.576 MHz)
on uio[0], BCLK (3.072 MHz) on uio[6] and LRCLK (48 kHz) on uo[4]. It
reads 16-bit samples from the ADC on uio[1] and sends the processed
samples to the DAC on uo[3]. The format is standard Philips I2S, 16-bit
signed, MSB first, 32 BCLKs per channel. The chip reads the left channel
only and sends the same (mono) sample on both output channels.
Clock. Every audio clock is divided from clk (one sample = 512 clk),
so any clock near 24.576 MHz works and the sample rate is simply clk / 512
(25 MHz gives 48.8 kHz). Every time and frequency in this document assumes
24.576 MHz (48 kHz) and scales with the clock.
Effect chain. Each sample runs through six stages in this fixed order. Each has its own switch, any combination can be on, and a stage that is off passes the signal through untouched:
compressor -> distortion -> (tone + gate) -> phaser -> tremolo -> delay
ui[0]): evens out your picking. It adds up to +9 dB to
quiet playing and pulls loud playing down (roughly 2.7:1 above about
-24 dBFS, down to -4.5 dB). Attack is about 0.7 ms, release about 85 ms,
and the gain moves smoothly, so it does not click.ui[1]): a fixed drive of about x8 into a soft "diode"
clipping curve. Turning it on also turns on the tone control and noise
gate below.ui[2]): a classic four-stage phaser (like a Phase 90, no
feedback) with two notches that sweep together (the first between about
200 Hz and 2 kHz, the second between about 1.2 and 12 kHz). K3 sets the
speed (about 1 to 11.6 Hz; about 1 Hz with no K3 fitted).ui[3]): a smooth volume wobble. K2 sets the depth (75% with
no K2) and K3 the speed (about 1 to 11.6 Hz; about 5 Hz with no K3).
The phaser and tremolo share K3, so with both on they run at the same
rate.ui[4], needs the PSRAM): a tape/PT2399-style echo. The chip
stores the audio in a ring buffer in the external PSRAM (32768 samples)
and plays it back after a time set by K4, from about 50 ms to 593 ms
(350 ms with no K4). Each repeat is a little darker than the last. K2 sets how loud
the echo is, from none up to about twice the dry level (the middle of
the knob, or no K2 fitted, is the same level as the dry signal). The
repeats fade at a fixed rate (each about 0.39 of the last) unless the K3
repeats switch is on. Moving K4 glides the time, which bends the pitch of
the echo like a tape delay. The echo starts about 0.7 s after power-up,
once the buffer has filled. With no PSRAM the delay passes the dry signal
through cleanly.ui[5]): the echo that is in the buffer right now loops
forever, without fading or darkening, while you play over it. Freeze also
works with the delay switch off: freeze a phrase, switch the delay off and
play dry, then switch the delay back on to bring the loop back. The delay
time holds while frozen. If freeze is already on at power-up, it holds
silence: switch it off and on again once you have played something.ui[6]): with this switch on, K3 also sets how many
repeats you get, in 7 steps from a single echo (K3 down) to long tails
that still fade (just below the top). It still sets the phaser and tremolo
speed too. The top eighth of K3 is runaway: the echo feeds back louder
than it went in and builds into a self-sustaining drone that continues
with nothing played. A ceiling on the stored level (-6 dBFS) stops it
growing past about the level of a hard-picked note; turn K3 down and it
fades away. Freeze takes priority over repeats. With ui[6] off, or no
K3 fitted, the repeats stay at the fixed 0.39.Switches. All eight ui pins carry only switches, so every DIP setting
is safe. They are synchronized and debounced on chip: an effect engages
within about 5-11 ms of the switch moving, and switch bounce never reaches
the audio. With every switch off the pedal is digital clean: the signal
still goes ADC -> chip -> DAC, unchanged apart from a one-sample delay. This
is not true bypass (see External hardware).
Knobs. The four knobs K1-K4 are read without an ADC chip. Each is a pot
and a capacitor on one uio pin: the chip discharges the capacitor, lets it
charge through the pot, and times how long the pin takes to read high. The
chip measures the four knobs in turn (all four within about 4 ms), smooths
the readings and ignores tiny changes, so a knob that is not moving gives a
steady value. Each reading is a number up to 255 (about 23 with the pot at
its 0 Ohm end, set by the 1 kOhm series resistor). Every knob is
optional: a knob pin tied to GND reads as "not fitted" and that knob's
default is used, so the pedal works with no knobs at all.
PSRAM. The delay uses one 64 Mbit SPI PSRAM (APS6404L, as on the Tiny
Tapeout QSPI Pmod) in plain 1-bit SPI mode with SCK = clk / 2 (12.288 MHz).
At power-up the chip resets the PSRAM and checks it by writing and reading
back a test pattern. uo[5] goes high when the check passes. While the
delay is on and no PSRAM has been found, the chip retries every 0.17 s, so a
PSRAM whose supply comes up late is still found. (With no PSRAM fitted this
is a short SPI burst every 0.17 s; switch the delay off to stop it.) Once a
PSRAM is found, switching the delay on and off does not re-check it, so a
frozen loop survives.
Indicators. uo[7] (the demoboard's decimal point) is a clip LED:
it lights for about 40 ms whenever the output hits full scale. uo[5]
(segment f) is the PSRAM detected LED. uo[6] is always high, to keep
the QSPI Pmod's flash chip deselected.
| Pin | Dir | Function |
|---|---|---|
| ui[0] | in | Switch: compressor |
| ui[1] | in | Switch: distortion (+ tone + gate) |
| ui[2] | in | Switch: phaser |
| ui[3] | in | Switch: tremolo |
| ui[4] | in | Switch: delay |
| ui[5] | in | Switch: delay freeze |
| ui[6] | in | Switch: K3 sets the delay repeats (top of K3 = runaway) |
| ui[7] | in | Unused |
| uo[0] | out | PSRAM SCK (idle low) |
| uo[1] | out | PSRAM CE# (idle high) |
| uo[2] | out | PSRAM MOSI / SI |
| uo[3] | out | I2S DAC data |
| uo[4] | out | I2S LRCLK / WS (48 kHz) |
| uo[5] | out | PSRAM detected LED (1 = found) |
| uo[6] | out | Always 1 (holds the Pmod flash CS0 high) |
| uo[7] | out | Clip LED (about 40 ms hold) |
| uio[0] | out | I2S MCLK (= clk, 24.576 MHz) |
| uio[1] | in | I2S ADC data |
| uio[2] | bidir | Knob K1: tone |
| uio[3] | bidir | Knob K2: echo level + tremolo depth |
| uio[4] | bidir | Knob K3: phaser + tremolo speed (+ repeats with ui[6]) |
| uio[5] | bidir | Knob K4: delay time |
| uio[6] | out | I2S BCLK (3.072 MHz) |
| uio[7] | in | PSRAM MISO / SO |
The knob pins are outputs (driven low) only while discharging their
capacitor and inputs the rest of the time. uio[1] and uio[7] are always
inputs.
The knob reading v goes from about 23 (pot at its 0 Ohm end) to 255. The formulas below give the full range from v = 0; the "about" figures are what a fitted knob reaches (v from about 23).
| Knob | Not fitted | What v sets |
|---|---|---|
| K1 | 2.2 kHz | tone corner in 4 steps: about 490 Hz, 1.0 kHz, 2.2 kHz, 5.3 kHz (v[7:6] = 0 to 3) |
| K2 | echo at dry level, trem depth 75% | echo level = v / 128 (0 to 2x, 128 = same as dry); tremolo depth 0 to nearly 100% |
| K3 | trem 5 Hz, phaser 1 Hz, repeats 0.39 | LFO rate = ((64 + v[5:0]) << v[7:6]) x 48000 / 2^22 Hz: about 1 to 11.6 Hz, roughly exponential. With ui[6] on: repeats = v[7:5] / 8 (0 to 0.75); v >= 224 = runaway |
| K4 | 350 ms | delay = ((64 + v[5:0]) << v[7:6]) x 28 samples: about 50 to 593 ms |
Quick start on the Tiny Tapeout demoboard. Set the project clock to
24.576 MHz (or the nearest the board can make), then wire the codec as
described under External hardware. Wire each knob pin that has no knob
(uio[2]-uio[5]) straight to GND so its default applies.
uio[0], BCLK (3.072 MHz) on uio[6] and LRCLK (48 kHz) on uo[4].
On the 7-segment display, segments b and g are lit (PSRAM CE# and the
flash hold idle high); other segments may flicker with the clock and SPI
traffic, which is harmless.ui[0]-ui[3] one at a time: compressor
(quiet notes get louder), distortion (with K1 changing the brightness),
phaser (a sweeping whoosh, about 1 Hz with no K3), tremolo (volume
pulsing, about 5 Hz with no K3). Turning K3 changes the phaser and
tremolo speed; K2 changes the tremolo depth.uo[5]) lights once it is found
(at reset, or when you switch the delay on).
Switch on ui[4] and play a short phrase: the echo comes back after
350 ms (no K4), and K2 sets how loud it is. If segment f stays dark,
check the PSRAM wiring and its 3.3 V supply.ui[5]: it
loops forever. Play over it. Switch the delay off and on again with
freeze still on: the loop comes back.ui[4] and ui[6]. With K3 down you
get a single echo; turning K3 up gives longer tails. Turn your amp down,
then turn K3 into its top eighth: the echo builds into a drone that keeps
going on its own. Turn K3 back down and it fades out.Without hardware, cd test && make -B runs the cocotb test suite (I2S
framing, every effect, the switches, knobs, PSRAM, delay, freeze, repeats
and clip LED). python3 wav_tool.py check compares the chip's output
bit-for-bit against an independent Python model of the whole pedal.
| Part | Example | Notes |
|---|---|---|
| Audio ADC | PCM1808 module | I2S slave, 24.576 MHz MCLK (512 fs) |
| Audio DAC | PCM5102A module (purple GY-PCM5102) | I2S slave, uses its internal PLL |
| Preamp | TL072 op-amp, high-impedance input | between the guitar and the ADC |
| PSRAM (for the delay) | Tiny Tapeout QSPI Pmod (APS6404L) | optional; without it the delay and freeze do nothing |
| Switches | up to 7 toggles or the demoboard DIPs | pull-down to GND, common to 3V3 |
| Knobs (optional, x4) | 10 kOhm linear (B10K) pot, 1 kOhm, 100 nF film or C0G | see Knobs below |
| Bypass | 3PDT latching footswitch | true bypass, outside the chip |
| LEDs | demoboard 7-segment, or 2 LEDs with resistors | clip, PSRAM detected |
All the chip's pins are 3.3 V logic and not 5 V tolerant.
The chip's I/O pins are 3.3 V; on the demoboard the chip and the digital side run from its USB supply. The PCM1808 module usually also needs 5 V for its analog side and 3.3 V for its logic; check your module. Keep every ground common. A practical split: the chip and logic from the demoboard's USB, the analog parts (preamp, codec analog supplies) regulated down from a 9 V pedal supply or battery, and one shared ground. Do not power the same 3.3 V rail from two regulators at once.
Wire both codec chips as I2S slaves of this chip:
| Chip pin | Codec pin |
|---|---|
uio[0] MCLK |
PCM1808 SCKI (keep this wire short, under 10 cm) |
uio[1] ADC data |
PCM1808 DOUT |
uio[6] BCLK |
PCM1808 BCK and PCM5102 BCK |
uo[4] LRCLK |
PCM1808 LRCK and PCM5102 LCK |
uo[3] DAC data |
PCM5102 DIN |
uio[0]) to its SCK instead. Its line output is about
2.1 V RMS, much hotter than a guitar.The Pmod is used in plain SPI mode, with RAM A only. Its signal labels PMOD1-PMOD8 are on header pins 1-4 (top row) and 7-10 (bottom row); pins 5 and 11 are GND, 6 and 12 are 3.3 V.
| Signal | Pmod label | Header pin | Connect to |
|---|---|---|---|
| Flash CS0 | PMOD1 | 1 | uo[6] (always 1: flash deselected) |
| SD0 (MOSI) | PMOD2 | 2 | uo[2] |
| SD1 (MISO) | PMOD3 | 3 | uio[7] |
| SCK | PMOD4 | 4 | uo[0] |
| SD2 | PMOD5 | 7 | not connected (or 10 kOhm to 3.3 V) |
| SD3 | PMOD6 | 8 | not connected (or 10 kOhm to 3.3 V) |
| RAM A CE# (CS1) | PMOD7 | 9 | uo[1] |
| RAM B CE# (CS2) | PMOD8 | 10 | 3.3 V (or uo[6]) |
Do not leave RAM B's chip select (header pin 10) floating. If it floats, RAM B can answer at the same time as RAM A and the PSRAM check fails at random. This was the main PSRAM problem found during bring-up.
Without a PSRAM, put a 100 kOhm pull-down on uio[7] so the check reads 0
and the delay stays a clean pass-through. Do the same on uio[1] if the
codec is not connected.
Each of ui[0]-ui[6] is a switch with an external pull-down resistor
(for example 10 kOhm) to GND, and the switch common to 3.3 V: open = off.
The demoboard DIP switches work directly. Toggles, stomp switches and
push-pull pots all work, since the chip debounces them. ui[7] is not
used.
Per knob: 3.3 V -> 1 kOhm -> lug 1 of a 10 kOhm linear (B10K) pot;
the wiper is the knob node (tie lug 3 to the wiper); node -> 100 nF
(film or C0G) -> GND; node -> the knob's uio pin. Wired this way the value
rises clockwise.
The knob circuit has been tested on an FPGA version of this design, not yet on the chip itself.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | Enable: comp | PSRAM SPI SCK | MCLK (24.576 MHz output) |
| 1 | Enable: dist | PSRAM CE# (RAM A, Pmod CS1) | I2S ADC data in |
| 2 | Enable: phaser | PSRAM SPI MOSI (SI) | Knob K1 post-dirt tone (RC pot, tie to GND if unused) |
| 3 | Enable: trem | I2S DAC data out | Knob K2 echo level + trem depth (RC pot, tie to GND if unused) |
| 4 | Enable: delay (PSRAM) | I2S LRCLK/WS (master, 48 kHz) | Knob K3 trem + phaser speed (RC pot, tie to GND if unused) |
| 5 | Delay freeze | PSRAM detected (1 = probe passed; segment f LED) | Knob K4 delay time (RC pot, tie to GND if unused) |
| 6 | Delay repeats from K3 (top of K3 = self-oscillation) | Flash CS0 hold (driven 1: keeps the QSPI Pmod flash deselected) | I2S BCLK (master, 3.072 MHz) |
| 7 | Unused | dp = clip LED (peak hold ~40 ms) | PSRAM SPI MISO (SO) |