Skip to content

Fork of namazso's "clockgen lite" firmware with improvements

Notifications You must be signed in to change notification settings

zooksman/cxadc-clockgen-mod

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CXADC ClockGen Modified

This is a fork of namazso's modification of Rene Wolf's CXADC Clock Generator + AUDIO ADC project.

Compared to namazso's version, this firmware makes just a few changes:

  1. Rather than undeclocking the Pico to 120MHz and dividing by 3 to produce a 40MHz clock, this version overclocks to 160MHz and divides the clock by 4 instead.
  • Why? Based on testing with an oscilloscope, the division by 3 results in a relatively slow rise time around 2ms and introduces clock jitter. In comparison, dividing by 4 produces a clock with a faster rise time of <1ms and reduced jitter.
  • The Pi Pico is officially supported to run at clock speeds up to 200MHz.
  • Additionally, VREG is set to auto-adjust to ensure the overclock is stable.
  1. Increases the drive strength of the GPIO clock pin (GPIO21) from 4ma to 8ma (Note: this is not the maximum current the pin can drive, rather, it is the maximum current draw at which the output voltage remains stable)
  • Why? Driving multiple sources with the clock induces excessive capacitive load, causing clock jitter. Without this modification, the clock can completely fail to drive 2 CX cards + PCM1802 with longer cable lengths. In my case, without this mod, I could not use a cable any longer than 6 inches; with it, up to 18 inches of cable works OK.
  • Lower clock jitter and faster rise times results in higher SNR from the CX card ADCs, and reduces drift/desync between the two CX cards and the PCM1802.
  • This does cause some additional overshooting in the clock signal, however, and may not be necessary for very short clock lines.
  1. Fixes a bug which causes the USB audio buffers not to be emptied properly, causing stale data from the last recording to be sent at the start of a capture. These changes were authored by rianhunter
  2. Fixes broken UART debug output caused by modified Pico sys clock
  3. Increases USB endpoint buffer size (Based on latest code from TinyUSB examples)

Rene Wolf's original project: https://gitlab.com/wolfre/cxadc-clock-generator-audio-adc Namazso's modification, "Clockgen Lite": https://github.com/namazso/cxadc-clockgen-mod/

Original Description:

Why?

  • Cost reduction: The main board PCB and the Si5351A is not necessary for this mod.
  • Alternative use cases: Nearly any combination of the Domesday Duplicator, CXADC cards, and this build works.
  • Simplicity: Some niche use cases were cut.

How?

There are several changes that make this possible:

  • The PCM1802 is configured in 512 division mode. This allows us to directly use a 40 MHz clock with it, while producing 78125 Hz sample rate recordings.
  • USB configuration was edited to allow enough buffer for the higher sample rate recording, as well as remove alternative clocks.
  • The Pi Pico is overclocked to 160 MHz. This allows a simple divisor for getting 40 MHz, without fractionals which introduce jitter.
  • The RP2040 has a feature where you can output divided clocks on a certain set of GPIO pins. Using this, we output 40 MHz on GPIO 21.

Shared build guide for any setup

Materials needed

  • PCM1802 board (€4) AliExpress
  • Raspberry Pi Pico (€2) AliExpress
  • Wires
  • Soldering setup (iron, solder, flux)

Steps

  1. Enable 512 fs master mode by bridging MODE0

Unfortunately the most common PCM1802 board has a bug where the + side of the bridgable connections is not actually connected to 3V3. To fix this, you will need to add a cable.

IMG_001231 IMG_001232

  1. Connect the PCM1802 board to the Pi Pico
  • 5V to VBUS
  • GND to GND (any)
  • PDW to GPIO17
  • DOUT to GPIO10
  • BCK to GPIO11
  • LRCK to GPIO12
  1. Flash the firmware on the Pi Pico

Build and flash the contents of the firmware folder. Alternatively, you can use the prebuilt version to skip the building step.

Use as a cheaper CXADC Clock Generator + audio ADC

  1. Connect PCM1802's SCK to GPIO21
  2. Build the necessary amount of clock generator adapters as in the original
  3. Connect their GND to GND and their clock input to GPIO21

How you make the connection is up to you, but cutting an SMA cable may be a very easy solution if using the SMA version of the adapter boards.

Use as an externally clocked audio ADC with a Domesday Duplicator

  1. Connect GNDs, connect PCM1802's SCK to the Domesday Duplicator's pin 40

Use as an externally clocked audio ADC with a MISRC

1. Connect the SMA clock output of the MISRC to SCK and GND of the PCM1802

Use the AUX pins and pcm_extract instead.

About

Fork of namazso's "clockgen lite" firmware with improvements

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 81.2%
  • Shell 15.1%
  • CMake 3.7%