Skip to main content
Visitor II
April 27, 2026
Question

STM32MP157-DK2 Two or more SAI clock synchronization

  • April 27, 2026
  • 0 replies
  • 51 views

Hi,

I'm working on to get the multiple SAI to Codec to work synchronized as the connection below,

1x MCLK
1x BCLK
1x FSYNC
4x DIN
4x DOUT

Where the three Clocks 1x lines (MCLK, BCLK & LRCLK) from one SAI master (actual pinout clock) & other SAI (pinout DIN & DOUT) sync clock internally (not sure possible b/w the SAI).


SAI1 (clock master) -> MCLK, BCLK, FSYNC, DIN/DOUT -> codec1
SAI2 (clock slave) -> (SAI1 MCLK, BCLK, FSYNC), DIN/DOUT -> codec2
SAI3 (clock slave) -> (SAI1 MCLK, BCLK, FSYNC), DIN/DOUT -> codec3
SAI4 (clock slave) -> (SAI1 MCLK, BCLK, FSYNC), DIN/DOUT -> codec4

According to the TRM RM0436 Rev 7 55.4.4 External synchronization should be used between the SAI.
does this need external pin connection between two SAI (all three clocks)? 

I'm facing error when arecord on SAI1 in the background and trying to start playback on SAI2, attached dts overlay file

arecord -D hw:0,0 -f S16_LE -r 48000 -c 2 -d 0 /dev/null &
sleep 1
aplay -D hw:0,2 -f S16_LE -r 48000 -c 2 ~/sample_freesound.mp3

Playing raw data '/home/root/sample_freesound.mp3' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
aplay: pcm_write:2178: write error: Input/output error

**** List of PLAYBACK Hardware Devices ****
card 0: aaudio0 [aaudio0], device 2: 4400c004.audio-controller-dit-hifi dit-hifi-2 [4400c004.audio-controller-dit-hifi dit-hifi-2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: aaudio0 [aaudio0], device 4: 4400b004.audio-controller-dit-hifi dit-hifi-4 [4400b004.audio-controller-dit-hifi dit-hifi-4]
Subdevices: 1/1
Subdevice #0: subdevice #0
**** List of CAPTURE Hardware Devices ****
card 0: aaudio0 [aaudio0], device 0: 4400a024.audio-controller-dir-hifi dir-hifi-0 [4400a024.audio-controller-dir-hifi dir-hifi-0]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: aaudio0 [aaudio0], device 1: 4400c024.audio-controller-dir-hifi dir-hifi-1 [4400c024.audio-controller-dir-hifi dir-hifi-1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: aaudio0 [aaudio0], device 3: 4400b024.audio-controller-dir-hifi dir-hifi-3 [4400b024.audio-controller-dir-hifi dir-hifi-3]
Subdevices: 1/1
Subdevice #0: subdevice #0