Skip to main content
Associate
January 21, 2024
Solved

Audio Codec & STM32

  • January 21, 2024
  • 2 replies
  • 4776 views

This is my first time asking something in ST's Forum. I am trying to build class-D amplifier with STA309A codec from ST. I am using STM32 MCU as a Master Transmitter for audio. The codec has 8 input channels for serial audio data, LRCLK, MCLK & BCLK. As of my knowledge, I2S can only transmit in stereo mode. How do I play more than 2 channels for STA309A's Inputs. Apologies for my bad English.

This topic has been closed for replies.
Best answer by AScha.3

STA309A input :

AScha3_0-1705859982571.png

So if you want to use 4 channels, send 1+2 with I2S as master , 3+4 as slave transmitter (sync to wck + bck ).

You need to have a I2S standard "stereo" output for every pair of channels, so check, the cpu you want to use, has as many as you need.

On newer cpus there is a SAI , that can also send I2S standard (and is more flexible than "old" I2S );

ex: stm32H563 has 3 x I2S ; and 2x SAI , each of this can have 2x I2S out, so max. 7 x (2ch) I2S possible;

or the 2 SAI can drive 4 x I2S , all the STA309 can receive.

2 replies

AScha.3
AScha.3Best answer
Super User
January 21, 2024

STA309A input :

AScha3_0-1705859982571.png

So if you want to use 4 channels, send 1+2 with I2S as master , 3+4 as slave transmitter (sync to wck + bck ).

You need to have a I2S standard "stereo" output for every pair of channels, so check, the cpu you want to use, has as many as you need.

On newer cpus there is a SAI , that can also send I2S standard (and is more flexible than "old" I2S );

ex: stm32H563 has 3 x I2S ; and 2x SAI , each of this can have 2x I2S out, so max. 7 x (2ch) I2S possible;

or the 2 SAI can drive 4 x I2S , all the STA309 can receive.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate
January 22, 2024

There is no option to synchronize wck and bck in CubeMX, do i have to connect them externally between I2S1 MASTER and I2S2 SLAVE Transmitters????

fdbe2d1d-f94c-46c9-9699-c976de95c368.jpg

Screenshot 2024-01-22 120429.jpg

AScha.3
Super User
January 22, 2024

Right, if there is no internal connection to select, you have to connect wck and bck externally .

"If you feel a post has answered your question, please click ""Accept as Solution""."