2025-09-24 10:08 PM - last edited on 2025-09-26 5:48 AM by mƎALLEm
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.
2025-09-24 10:54 PM
> 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.
2025-09-25 1:22 AM
Hello @BandanaChaudhary ,
You may get inspired from the implementation of I2S Audio example (with an external codec) available in STM32CubeF4 package:
This example allows playing an audio file with an external codec on the STM32F412G-Discovery board through the I2S peripheral using DMA transfer.
2025-09-25 1:31 AM
@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!
2025-09-26 5:44 AM
2025-09-26 5:53 AM - edited 2025-09-26 5:57 AM
Hello,
You can inspire from the BSP example for STM32F412G-Discovery board:
It contains an audio player and audio recording example.
Files list linked to the audio application:
The example provided by @Imen.D can also help you.
Hope that helps.
2025-09-26 5:54 AM
So have you tried the example linked earlier by @Imen.D ?