cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP157-DK2 Two or more SAI clock synchronization

ssekar
Associate

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

2 REPLIES 2
PatrickF
ST Employee

Hi @ssekar 

did you look to this page ?

https://wiki.st.com/stm32mpu/wiki/SAI_device_tree_configuration#Sharing_master_clock_between_two_SAIs

Regards.

 

 

 

In order 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.
Tip of the day: Try Sidekick STM32 AI agent, see here
ssekar
Associate

Hello Patrick,

Thanks for time to check, yes I had refereed the mentioned wiki page. It has information about SAI sub-block configuration, I need the inter-SAI synchronization.

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)?