roam/20230527122415-digital_audi...

4.6 KiB

Digital Audio Switch

ESP32 Pin Connections   ATTACH

ESP32-Pinout.png

Connection Pin Pin Connection
EN GPIO23 SWITCH INH
ROT SWITCH GPIO36* (VP) GPIO22 I2C SCL
GPIO39* (VN) GPIO1
GPIO34* GPIO3
GPIO35* GPIO21 I2C SDA
ROT A GPIO32 GPIO19 SWITCH B
ROT B GPIO33 GPIO18 SWITCH A
DAC BCK GPIO25 GPIO5
DAC DIN GPIO26 GPIO17
DAC LRCK GPIO27 GPIO16
GPIO14 GPIO4
SPI MISO GPIO12 GPIO2
SPI MOSI GPIO13 GPIO15 SPI CS
GND GND GND
VIN 3V3 VCC

Components

Digital Potentiometer (MCP4231)

Pins

  • SPI

OLED Display

Pins

  • I2C

2-Channel Switch (CD052)

Pins

  • Channel Select A
  • Channel Select B
  • INH (Mute)
  • VCC
  • GND

Digital Analog Converter (PCM5102)

Communicates via the I2S protocol.

Pins

  • BCK
  • DIN
  • LRCK
  • VCC
  • GND

sck_pin = Pin(14) # Serial clock output ws_pin = Pin(13) # Word clock output sd_pin = Pin(12) # Serial data output

DAC Pin I2S Counterpart Pin
LRCK Word Clock (Word Select (WS) / Left-Right Clock (LRCLK))) IO27
DIN Multiplexed Data Line (Serial Data (SD)) IO26
BCK Bit Clock (Continuous Serial Clock / SCK) IO25
SCK Master Clock (not part of the I2S standard) GND

Wiring notes

https://raspberrypi.stackexchange.com/a/94951/154943

On these purple PCBs there are 5 sets of bridging pads.

On the front (component side) there is one pair of pads which may be bridged to tie the SCK (system clock) low. This will force the PCM510x to generate the system clock using its internal PLL. You may bridge these pads to remove the need for an external SCK or connect the SCK pin to ground (0V). The Raspberry Pi does not supply a system clock so this will be required to connect to the Raspberry Pi.

On the back (non-component side) there are 4 sets of 3 pads for the 4 functions:

FLT
Filter select : Normal latency (Low) / Low latency (High)
DEMP
De-emphasis control for 44.1kHz sampling rate: Off (Low) / On (High)
XSMT
Soft mute control(1): Soft mute (Low) / soft un-mute (High)
FMT
Audio format selection : I2S (Low) / Left justified (High)

The centre pad is connected to the corresponding pin. Each of these function pads may be bridged with solder either high or low (or the pins connected to +3.3V / 0V). (My board is supplied with 1, 2 & 4bridged low and 3 bridged high, i.e. normal latency filter, 44.1kHz de-emphasis disabled, soft-mute not asserted, I2S audio format.)

The normal filter is an FIR with good response, delaying the signal by approx. 500us (at 44.1 kHz) which should be fine. The fast filter is an IIR with slightly poorer response and delays the signal approx. 80us. Very few (if any) audio sources have pre-emphasis applied so DEMP should be low. The XSMT pin would allow muting of the output via a GPI (if the solder bridge was removed). Raspberry Pi supports I2S bitstream so FMT should be low.

Do not connect pins to a supply rail if the solder bridges are applied.

The VIN pin goes to a pair of voltage regulators, one of which provides the 3.3V required by the PCM510x. This also connects to the A3V3 pin. The regulator is low drop so VIN may be fed from 3.3V or 5V.

The input pins SCK, BCK, DIN & LCK are fed through a resistor pack which should allow 5V signals to be connected to the 3.3V PCM510x chip, i.e. the board is 3.3V but 5V tolerant.

Note: LCK pin is actually LRCK (left right clock).

The 'L' & 'R' pins are directly connected to the 3.5mm jack. Simultaneous connection to both should be avoided. The 2 'G' pins are connected to ground and are provided for convenience of wiring audio output jacks.

This is a very well designed PCB. It is a shame that this description is not provided elsewhere.

Rotary Encoder Switch

Pins

  • VCC
  • GND
  • Switch Input
  • Rotary 1
  • Rotary 2