Skip to main content
darla14
Associate III
Oct 15, 2026 5:01 PM UTC
Solved

SAI1 for Audio Codec on STM32WBA65

Hello, 

I am trying to interface Audio codec with stm32wba65 (using reference: GitHub - stm32-hotspot/STM32WBA-Advanced-BLE-Broadcast-Speaker: The BLE Speaker is a prototype for a portable Bluetooth® Low Energy speaker supporting broadcast sink, scan delegator role and optionally unicast server role · GitHub ) , 

there is an additional MCU between STM32WB55 and Audio codec but i am thinking to use the audio codec directly over SAI1. as SAI1 has 2 blocks SAIA and SAI B. Is it possible to interface audio codec via one block (SAI A) and any other MIC (I2S or PDM) another block (SAIB) ? can someone please tell if it is possible .If yes can plz provide ioc settings.?

 

what things to be take into care?

Regards,

D

TMANE.1Best answer
ST Employee
Oct 19, 2026 9:53 AM UTC

Hi,

 

from my understanding, you want to use 1 simplex I2S to the codec, and 1 simplex I2S to the MIC. Then, you are master on both (B block synchronous to A block). 

As I2S needs the bitclock and frame sync, SCK_A and FS_A must be connected to both your codec and the MIC. Looking at the IOC, SD_A is transmitting, so connect to the CODEC, and SD_B is receiving, so connect to the MIC. 

The MCLK_A might be connected to both the codec and mic, but it is not part of the I2S itself and is more depending on your component (CODEC / MIC) requirement. 

 

Note that only block A support PDM, so if you might connect a PDM mic instead of I2S MIC, use the block B for the codec. 

 

Best regards,

9 replies

AScha.3
Super User
Oct 15, 2026 7:55 PM UTC

Hi,

one SAI channel can send or receive, so can use A as master transmit I2S to a DAC or codec,

and B as master to receive I2S mic data.

But if “codec” is in and out, ADC and DAC same time, you need A and B for the codec. Thats it.

If you feel a post has answered your question, please click on " Best Answer ".
darla14
darla14Author
Associate III
Oct 16, 2026 5:11 AM UTC

​@AScha.3 Thanks for your prompt response. Generally, i need it only for DAC (for speaker connected to codec)  , but with other Block i want some other mic. Can you please suggest the changes or connections. I attach my ioc file.

Any existing example will also be helpful . Many thanks.

Regards

 

D

AScha.3
Super User
Oct 16, 2026 6:36 AM UTC

Which codec or dac you connect ? (in ioc i see nothing)

If you feel a post has answered your question, please click on " Best Answer ".
darla14
darla14Author
Associate III
Oct 16, 2026 7:04 AM UTC

Hello ​@AScha.3 , 

codec is MAX9867ETJ+

in the ioc plz see the SAI1 section. It is configured only for SAIB for codec. SAIA is disabled. I am not sure how to configure one block (SAIB) for codec and another for i2s/Pdm mic? 

 

Regards,

 

AScha.3
Super User
Oct 16, 2026 7:10 AM UTC

ok, so why extra mic input, when codec already has mic inputs ?

Explain, what you want to do this way.

 

+

attached ioc with pdm mic in + codec out.

 

If you feel a post has answered your question, please click on " Best Answer ".
darla14
darla14Author
Associate III
Oct 16, 2026 8:11 AM UTC

Thanks i will check. its a speaker application , mic is just optional but still want to keep it on bluetooth side as i want to put codec in low power most of the time (if possible with this ip) and use mic for waking up.

AScha.3
Super User
Oct 16, 2026 8:32 AM UTC

attached ioc with  codec out  + in . codec is in slave mode.

You know, you have to program the codec over I2C to the mode you want ?

Otherwise, if only/first working as a speaker device , a more simple DAC would be much more easy, choose something like PCM5102A .

 

If you feel a post has answered your question, please click on " Best Answer ".
darla14
darla14Author
Associate III
Oct 16, 2026 5:29 PM UTC

Yes , i agree on I2C . 

Would it possible to update the user label in the ioc to know which one goes to codec and which all lines go to MIC (Considering it is i2s Mic) . first two - clock and data are for Mic and rest for codec right??)

 

 

TMANE.1Best answer
ST Employee
Oct 19, 2026 9:53 AM UTC

Hi,

 

from my understanding, you want to use 1 simplex I2S to the codec, and 1 simplex I2S to the MIC. Then, you are master on both (B block synchronous to A block). 

As I2S needs the bitclock and frame sync, SCK_A and FS_A must be connected to both your codec and the MIC. Looking at the IOC, SD_A is transmitting, so connect to the CODEC, and SD_B is receiving, so connect to the MIC. 

The MCLK_A might be connected to both the codec and mic, but it is not part of the I2S itself and is more depending on your component (CODEC / MIC) requirement. 

 

Note that only block A support PDM, so if you might connect a PDM mic instead of I2S MIC, use the block B for the codec. 

 

Best regards,