DAC Design with PCM1795 and STM32


yes please
I’ll rebuild this as a real IC-level DAC schematic: PCM1795 pins, three OPA1612 dual op-amps, I/V parts, differential outputs, regulators/connectors, then verify ERC before stopping at the schematic stage.
I found the previous connector-only blocks. I’m removing those and replacing them with actual ICs and analog-stage components now.
Rebuilt the project as a real IC-level schematic instead of connector blocks: PCM1795, 3× OPA1612, LT3042 3.3 V/5 V rails, I/V feedback networks, differential output stage, RCA outputs, and power/input headers are now present and wired. ERC checks are currently clean for the checks run, and the project spec was updated.
Open items:
  • The PCB layout is not done yet; per workflow, this is the schematic checkpoint before layout.
  • The PCM1795 library symbol/footprint must be visually checked against the TI datasheet pinout before fabrication.
  • STM32F407 exact I2S/SPI GPIO mapping is still your next firmware/pinout decision.
Suggested next steps:
  1. Review the schematic view and confirm it now looks like the detailed circuit you expected.
  2. I can next create the physical PCB placement with DAC + OPA stages tightly clustered.
  3. After placement approval, I can route the board with low-noise analog layout rules.
Proceed to placement
Verify PCM1795 symbol
Explain schematic
Layout best practices
Run deeper review

Firmware Starter — STM32F407 PCM1795 DAC Source
Platform & Toolchain
  • MCU board: External STM32F407 board
  • Framework: STM32 HAL / STM32CubeIDE
  • Purpose: Generate I2S audio clocks/data and configure PCM1795 over SPI/control pins.
Pin Mapping
Exact STM32 GPIO pins depend on the specific STM32F407 board header wiring. The schematic currently names the board-level connector nets:

Table


FunctionSchematic NetSTM32 PeripheralDirectionNotes
Bit clockI2S_BCKSPI/I2Sx_CKMCU → DACSelect an STM32 I2S-capable pin.
Word selectI2S_LRCKSPI/I2Sx_WSMCU → DACAlso called LRCK/WS.
Audio dataI2S_DATASPI/I2Sx_SDMCU → DACPCM audio data stream.
Master clockI2S_MCLKSPI/I2Sx_MCKMCU → DACUse if the PCM1795 board requires external MCLK.
Control clockSPI_SCKSPIx_SCKMCU → DACPCM1795 control port.
Control data inSPI_MOSISPIx_MOSIMCU → DACRegister writes.
Control data outSPI_MISOSPIx_MISODAC → MCUOptional, if DAC board exposes readback.
Chip selectDAC_CSGPIO outputMCU → DACActive level to confirm from board.
ResetDAC_RSTGPIO outputMCU → DACActive level to confirm from board.
MuteDAC_MUTEGPIO outputMCU → DACActive level to confirm from board.
Example STM32 HAL Source Skeleton

C


#include "main.h"
#include <string.h>

I2S_HandleTypeDef hi2s3;
SPI_HandleTypeDef hspi1;

#define DAC_CS_GPIO_Port     GPIOA
#define DAC_CS_Pin           GPIO_PIN_4
#define DAC_RST_GPIO_Port    GPIOA
#define DAC_RST_Pin          GPIO_PIN_0
#define DAC_MUTE_GPIO_Port   GPIOA
#define DAC_MUTE_Pin         GPIO_PIN_1

static void dac_cs_low(void)  { HAL_GPIO_WritePin(DAC_CS_GPIO_Port, DAC_CS_Pin, GPIO_PIN_RESET); }
static void dac_cs_high(void) { HAL_GPIO_WritePin(DAC_CS_GPIO_Port, DAC_CS_Pin, GPIO_PIN_SET); }

static HAL_StatusTypeDef pcm1795_write_reg(uint8_t reg, uint8_t value) {
    uint8_t frame[2];
    frame[0] = reg;
    frame[1] = value;
    dac_cs_low();
    HAL_StatusTypeDef st = HAL_SPI_Transmit(&hspi1, frame, sizeof(frame), HAL_MAX_DELAY);
    dac_cs_high();
    return st;
}

static void pcm1795_reset_sequence(void) {
    HAL_GPIO_WritePin(DAC_RST_GPIO_Port, DAC_RST_Pin, GPIO_PIN_RESET);
    HAL_Delay(10);
    HAL_GPIO_WritePin(DAC_RST_GPIO_Port, DAC_RST_Pin, GPIO_PIN_SET);
    HAL_Delay(10);
}

static void pcm1795_init(void) {
    dac_cs_high();
    HAL_GPIO_WritePin(DAC_MUTE_GPIO_Port, DAC_MUTE_Pin, GPIO_PIN_SET);
    pcm1795_reset_sequence();

    // TODO: Replace register addresses/values with the exact PCM1795 board mode.
    // Configure audio format, oversampling, de-emphasis, and mute control per PCM1795 datasheet.
    // pcm1795_write_reg(REGISTER_ADDR, REGISTER_VALUE);

    HAL_GPIO_WritePin(DAC_MUTE_GPIO_Port, DAC_MUTE_Pin, GPIO_PIN_RESET);
}

int main(void) {
    HAL_Init();
    SystemClock_Config();
    MX_GPIO_Init();
    MX_SPI1_Init();
    MX_I2S3_Init();

    pcm1795_init();

    // Example 16-bit stereo silence buffer. Replace with real PCM stream.
    uint16_t silence[128] = {0};

    while (1) {
        HAL_I2S_Transmit(&hi2s3, silence, 128, HAL_MAX_DELAY);
    }
}
Build & Flash Instructions
  1. Create an STM32CubeIDE project for the exact STM32F407 board.
  2. Enable one SPI peripheral in I2S master transmit mode for BCK/LRCK/DATA/MCLK.
  3. Enable one SPI peripheral or GPIO bit-banged interface for PCM1795 control.
  4. Map the GPIO labels above to the actual header pins used on the STM32F407 board.
  5. Build and flash with ST-LINK or the board's onboard programmer.
TODO Before Hardware Bring-Up
  • Confirm exact STM32F407 board model and available I2S pins.
  • Confirm PCM1795 board pinout and whether MCLK is required.
  • Confirm PCM1795 register settings for I2S word length, sample rate, and analog output mode.
  • Platform & Toolchain

  • Pin Mapping

  • Example STM32 HAL Source Skeleton

  • Build & Flash Instructions

  • TODO Before Hardware Bring-Up