cancel
Showing results for 
Search instead for 
Did you mean: 

Play Audio using STM32F412ZT6

BandanaChaudhary
Associate

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.

6 REPLIES 6
Ozone
Principal II

> 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.

Imen.D
ST Employee

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.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Andrew Neil
Super User

@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!

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
BandanaChaudhary
Associate

i am using STM32F412ZGT6 Discovery board and wm8994 codec driver.

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.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

So have you tried the example linked earlier by @Imen.D ?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.