Coder Social home page Coder Social logo

tobiasvandyk / stm32f411-pcm5102a-24bit-usb-audio-dac Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 4.0 28.23 MB

2023-2024: An inexpensive USB Audio DAC that implements 24-bit resolution audio at 44.1kHz, 48kHz or 96kHz, using an STM32F411 Black Pill with a PCM5102A i2s DAC module.

License: GNU General Public License v3.0

pcm5102a stm32f411 24bit-usb-dac windows10-stm32cubeide

stm32f411-pcm5102a-24bit-usb-audio-dac's Introduction

STM32F411 PCM5102A 24bit USB Audio DAC

This is an inexpensive USBAudio DAC that supports 24-bit resolution audio at 44.1kHz, 48kHz or 96kHz. It uses an STM32F411 Black Pill with two different i2s PCM5102A DAC modules - they differ in size and design. The software is based on this STM32F4xx USB to I2S DAC Audio Bridge and the issue as discussed here.

Two sizes of the DAC were made - the larger size module uses a PCM5102A DAC with three LDO regulators but with no mute control pin, and the (much) smaller sized DAC uses two LDO regulators and has a mute control pin.

The volume control code modifications as discussed in the issue linked to above, was added to a windows port of the code. The Windows 10 STM32CubeIDE project is included here as F411_USB_I2S.zip and the binaries are in build.zip - the hex file can directly be uploaded via the STM32CubeProgrammer using a standard ST-Link module. Note all licenses applicable are the original source code licenses.

The current source build binaries are included here as build-24March2023.zip, but now built with STM32CubeIDE version 1.12. Previous source (Feb 2023) binaries are here as build-linux3.tar.gz (Linux Mint 21.1 with STM32CubeIDE 1.11.2), and build-win10.zip (based on project files STM32F411_USB_AUDIO_DAC-win10.zip), built on Windows 10 using the same version of STM32CubeIDE.

For detailed instructions in setting up STMCube refer to this document: Installing STM32CubeIDE in Linux Mint 21.1 and in Windows 10, and compiling and uploading the STM32F411 USB Audio DAC firmware.

The USB DAC with the volume control identifies as PCM5102A DAC and the older non-volume version as USB to I2S DAC - refer to the screen dump shown below.

The larger sized PCM5102A DAC module used does not have a hardware mute breakout pin. Two changes to bsp_audio.c gives an alternative "volume mute" - the compiled version is in MuteFix.zip. This version uses only the red and green LEDs to indicate the three frequency modes - those changes are in main.c

uint8_t BSP_AUDIO_OUT_SetMute(uint8_t mute) {
	if (mute) {
		BSP_AUDIO_OUT_Pause();  // AUDIO_MUTE_ON();
		}
	else {
		BSP_AUDIO_OUT_Resume(); // AUDIO_MUTE_OFF();
		}
	return AUDIO_OK;
	}

Connections for the larger-sized DAC:

F411    PCM5102A    LED    Description 
--------------------------------------------------------------------
5V      VCC
GND     GND            
B13     BCK                I2S_BCK (Bit Clock)
B15     Data               I2S_SDI (Data Input)
B12     LRCK               I2S_WS (LR Clock)
-------------------------------------------------------------------- 
B3                 RED     Fs = 96kHz (all 220R to 3v3)
B6                 GRN     Fs = 48kHz (Red+Green for 44.1kHz)
3v3                LED through-hole common
 
C13             On-board   Diagnostic Blue LED
--------------------------------------------------------------------

The smaller DAC is similarly-sized as the DAC used by Har-In-Air - but only two SMD LEDs are used for the 3 frequency indicators. Refer to SMD-LED-Resistor for an approximate layout for the SMD resistors and LEDs. Use a 4-pin JST male connector at the bottom of the STM32F411 board.

The source+build and the build-folder-only are included here as Small-USBAUDIODAC-Jan2024.zip and Small-build-Jan2024.zip - insignificant changes were made to main.c, usbd_desc.c, and bsp_audio.c.

The 3D case files are in the STL folder named Small*.stl. It is based on this PCB-holder SCAD model. Various length and width parameters for other MCU-boards (namely an RP2040 Pico, STM32F103 Blue Pill, STM32F411 Black Pill, and a Teensy 4.1) are in the file pcbholder-params also in the STL folder.

Connections for the smaller-sized DAC:

F411    PCM5102A    LED    Description 
--------------------------------------------------------------------------------------
5V      VCC
GND     GND            
B13     BCK                I2S_BCK (Bit Clock)
B15     DIN                I2S_SDI (Data Input)
B12     LCK                I2S_WS (LR Clock)
B8      XMT                Mute Control

Bridge the SCK pads on top with solder to connect it to earth
No other solder bridges are required for the 4 pad-sets on the other side of the PCB
--------------------------------------------------------------------------------------- 
B3                 GRN     Fs = 96kHz (both SMD-LEDs 1k ohm to 3v3)
B6                 RED     Fs = 48kHz (Red+Green for 44.1kHz)
3v3                LED SMD-1206 common
 
C13             On-board   Diagnostic Blue LED
---------------------------------------------------------------------------------------

The STM32F11 can be obtained here and the larger PCM5102A DAC module here or the smaller-sized DAC here or here.

This DAC is the perfect companion for the 1976 November Wireless World An Advanced Preamplifier by Douglas Self.

There are a number of variations of the (Chinese) PCM5102A modules - where available schematics of single, double and triple (as used here) LDO regulator modules are shown below.

stm32f411-pcm5102a-24bit-usb-audio-dac's People

Contributors

tobiasvandyk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

stm32f411-pcm5102a-24bit-usb-audio-dac's Issues

I need your help please

Hello, what is the possibility that you can help me set up or develop a code based on this, even if it is necessary to pay you, I need, based on the black pill card and the pcm5102, with the USB audio protocol to create a kind of crossover and digital graphic equalizer where it makes use of the DSP core integrated into the card and the control of the band gains is carried out through a graphic interface, either digital through an Android application or an analog interface, please I need your help.

master clock frequency

firstly, thanks for your work on this subject.
I was looking to replace the PCM5102a with a better dac. I noticed that the STM32F411xE configuration could provide the masterclock. what would the frequency at the rated sample frequencies(44.1, 48 and 96 kHz) of your firmware be when masterclock generation is enabled?

thanks,

Playing does not start reliably and other issues

1 Reverted the 17 March 2023 changes Playing does not start reliably. Build files and changed file usbd_audio.c in Playing does not start reliably.zip. Will test for a few weeks on Windows 10/11

Playing does not start reliably.zip

2 License - read the comments here.

3 Clearly hear the difference between a 24 and 16 bit DAC by listening to the sibilance during the 13 year old LeAnn Rimes Unchained Melody rendition.

4 Keep track of IDE versions used for builds - recent IDE omits audio USB

5 Three solderbridges 4L 2L 1L are a must to avoid an occasional (once every few days) loud crunching sound.
solderbridges-but-no-H3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.