Skip to main content
Visitor II
September 25, 2025
Question

Play Audio using STM32F412ZT6

  • September 25, 2025
  • 4 replies
  • 516 views

Dear Team,

I hope you’re doing well.

I am currently working on a project using the STM32F412ZGT6 board, and I need assistance to play audio via the built‑in codec. I have configured the I2S, I2C Pin and initiated some tests, but I am facing difficulties in getting proper audio output.

Could you please help me with:

  • Sample initialization code (HAL / low‑level) for I2S / codec setup

  • Recommended DMA / buffer handling strategy

  • Any tips or pitfalls specific to the STM32F412 series audio path

  • Example code or reference projects that use the built‑in codec

If needed, I can share my current code, configuration settings (clock, pin mappings, CubeMX file, etc.). Your guidance would be of great help in moving forward.

 

Thank you very much for your time and expertise.

    This topic has been closed for replies.

    4 replies

    Explorer
    September 25, 2025

    > I am currently working on a project using the STM32F412ZGT6 board, and I need assistance to play audio via the built‑in codec.

    The F412 has no "built-in codec", you would need to name the board you are working with.

    Many Cube examples are for specific boards, especially when it comes to such peripheral functions.
    And your board might have been released before or during the transition time from SPL to Cube, like e.g. the F407 Discovery board.
    The "legacy" SPL-based firmware + example packages for those boards are far more complete and stable than the Cube counterparts.

    Technical Moderator
    September 25, 2025

    Hello @BandanaChaudhary ,

    You may get inspired from the implementation of I2S Audio example (with an external codec) available in STM32CubeF4 package:

     STM32CubeF4/Projects/STM32F412G-Discovery/Examples/I2S/I2S_Audio at master · STMicroelectronics/STM32CubeF4 · GitHub

    This example allows playing an audio file with an external codec on the STM32F412G-Discovery board through the I2S peripheral using DMA transfer.

    Super User
    September 25, 2025

    @BandanaChaudhary wrote:

    using the STM32F412ZGT6 board, .


    As @Ozone said, you need to tell us what board, exactly, you are using.

    Please see: How to write your question to maximize your chances to find a solution

     


    @BandanaChaudhary wrote:

    the built‑in codec..


    Because we don't know what board you have, we can't know what CODEC that is!

    Visitor II
    September 26, 2025

    i am using STM32F412ZGT6 Discovery board and wm8994 codec driver.

    Technical Moderator
    September 26, 2025

    Hello,

    You can inspire from the BSP example for STM32F412G-Discovery board:

    https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM32F412G-Discovery/Examples/BSP

    It contains an audio player and audio recording example.

    Files list linked to the audio application:

    mALLEm_0-1758891446740.png

    The example provided by @Imen.D can also help you.

    Hope that helps.