Skip to main content
Senior II
November 27, 2025
Solved

I2S passthrough - but STM32 only has one I2S data pin ?

  • November 27, 2025
  • 2 replies
  • 337 views

I am developing I2S on the NUCLEO-L433RC-P development board using a BT401 bluetooth audio receiver and MAX98357A I2S amplifier.

I need to pass the I2S audio data through the STM32L4333 (refer to diagram below). 

I have done this before using a Microchip dsPIC33E but this has both DATA IN and DATA OUT pins for I2S.

Whereas the STM32 only has a single DATA pin (SD), so it can only be DATA IN or DATA OUT.

Does this mean I cannot use the STM32 to pass through I2S data ?

freeflyer_0-1764239514938.png

 

Best answer by AScha.3

Hm, ok, now i know. :)

Seems ok, but :

AScha3_0-1764671147326.png

set SAI1_A as slave receiver , connected to BT40xx; and SAI1_B (syncron. to A) transmitter ;

then you are sync to the data stream from BT and stay sync , also for sending same data.

You just need two DMA streams in circular mode, to write+read same buffer area.

Then you get continuous "pass through" , without any cpu load or action.

Only if you want to add your message, you have to fill the buffer in the callbacks with the cpu doing this.

2 replies

freeflyerAuthor
Senior II
November 30, 2025

Merged threads.

I am using an STM32L433 to pass I2S audio from a bluetooth receiver (BT401) to a PCM amplifier (MAX98357A) using DMA.

I have got it working, but there is an issue with the clock.  It plays the audio fine for a few seconds and then there is some interference for a few seconds and this repeats.

I have concluded that its due to the two seperate clocks i.e. the clock in the bluetooth receiver and the clock in the STM32.

The bluetooth receiver is configured to play 48kHz audio but the STM32 is configured to play 49.107kHz.

Even when I configured the STM32 to play 48kHz, the same issue occured but for different durations (assume due to discrepancies between the seperate clocks).

Below is my current architecture...

freeflyer_1-1764537408241.png

I am thinking that the bluetooth receiver and the STM32 need to use a common clock, so need to either change the architecture and/or configuration, but I am not sure what setup I need to achieve this.

The bluetooth receiver can be configured as:

  • I2S master
  • I2S slave
  • It also has a master clock output (12.288MHz for 48khz audio). 

The STM32 SAI blocks can be configure as:

  • Master
  • Master with master clock out
  • Asynchronous slave
  • Synchronous slave

Note that the PCM amp does not require a master clock.

freeflyerAuthor
Senior II
December 1, 2025

I was wondering if I could use the master clock from the bluetooth receiver (which is 12.288MHz) as the clock for the STM32 SAI.

Then I noticed there is an option in CubeMX Clock Configuration to use SAI1_EXT...

 

freeflyer_0-1764618944887.png

 

So I enabled the SAI1 external clock...

freeflyer_2-1764621175322.png

And connected the bluetooth receiver master clock output to the STM32 SAI external clock input....

freeflyer_3-1764621390175.png

With the bluetooth master clock of 12.288MHz going to the STM32 SAI1_EXTCLK pin, I can see data on the SAI1_B DMA Rx buffer and can see data copied to the SAI1_A DMA Tx buffer, but there are no signals on the SAI1_A pins (FS, SCK and SD) when I look at them on an oscilloscope.  So why is SAI1_A not transmitting data on these pins since changing the SAI clock source to SAI_EXTCLK ?

AScha.3
Super User
December 1, 2025

Why you want "pass through " ? sense ? compared, to just connect it, to pass data ?

 

And with SAI it should work:

- have receiver : slave receiver

- transmit: synchronous sync to receiver , slave transmitter

"If you feel a post has answered your question, please click ""Accept as Solution""."
freeflyerAuthor
Senior II
December 2, 2025

Because I want to intercept the Bluetooth audio when an event occurs and replace it with a voice prompt stored in external flash. 

Once I get pass through working I can modify the code to replace one of the audio channels (left or right) with the voice prompt. The result will be a mix of the Bluetooth audio and the voice prompt. because the amplifier is configured to convert the stereo I2S to mono (by summing both channels) 

unless there is some other way to achieve this ?