HI NXP
I had issue a question of this topic, but I can't replay it anymore, so I re-create it here.
I had create a sound card for PCM(SAI2) on IMX8. (SAI2 PCM connect to BT module).
We use android OS with tinyalsa on it.
And we can see the waveform on the scope, there is clk, sync and output data(TX) on SAI2 after issue cmd "tinyplay chirp.wav -D 3 -d 0" (bluetooth sound card is 3 on SAI2).
Then we set the BT module to PCM loopback mode.
After set the BT module to PCM loopback mode, we can see the input data on PCM RX.
But when we use tinycap(tinycap test.wav -D 3 -d 0 -c 1 -r 8000) to record the RX data, we just got the .wav header with dummy data(0).
Did I miss any setting on the audio driver or device tree? Below is the device tree of my bluetooth sound card on SAI2 PCM.
+ btsco_codec: btsco_codec@0 {
+ compatible= "linux,bt-sco";
+ status = "okay";
+ };
+ sound-btsco {
+
+ compatible = "fsl,imx-audio-btsco";
+ model = "btsco-codec";
+ audio-cpu = <&sai2>;
+ btsco-controller = <&btsco_codec>;
+
+ };
+&sai2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_sai2>;
+ assigned-clocks = <&clk IMX8MM_CLK_SAI2>;
+ assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
+ assigned-clock-rates = <24576000>;
+ status = "okay";
+};
+ pinctrl_sai2: sai2grp {
+ fsl,pins = <
+ MX8MM_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC 0xd6
+ MX8MM_IOMUXC_SAI2_TXC_SAI2_TX_BCLK 0xd6
+ MX8MM_IOMUXC_SAI2_RXD0_SAI2_RX_DATA0 0xd6
+ MX8MM_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0 0xd6
+ >;
+ };
Thanks
HI igorpadykov
"by "SYNC output" - what i.MX8MM signal do you mean ?"
->MX8MM_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC
And in the fsl_sai.c, which kind of synchronous mode should i set? sai-synchronous-rx or sai-asynchronous?
I'm not sure the meaning of "synchronous mode".
Thanks
HI igorpadykov
When I config the cpu_dai format to master as below, I can generate the CLK and also see the TX data while tinyplay exec.
But I can't see the SYNC output, did I miss any config?
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAI_FORMAT_DSP_A
| SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_CONT);
Thanks
by "SYNC output" - what i.MX8MM signal do you mean ?
Best regards
igor
HI igorpadykov
There is PCM in below section 3.5
https://www.nxp.com/docs/en/application-note/AN12202.pdf
And it's also mentioned in below community
https://community.nxp.com/thread/524538
So, how do I config the SAI2 to above PCM interface/format? Or I can just config it to I2S/TDM?
Thanks
HI igorpadykov
Does the SAI2 can config to PCM interface? Or just I2S?
Thanks
Hi Jimi
>Does the SAI2 can config to PCM interface?
"PCM" is general meaning, so you should always check external chip
documentation for its interface timings.
Best regards
igor
HI igorpadykov
We can see the wavform on the scope on PCM RX.
Is there any method to see the real value on SAI2(PCM) RX.
Thanks
Hi Jimi
>Is there any method to see the real value on SAI2(PCM) RX.
seems only by oscilloscope or reading SAI Receive FIFO Register RFR.
Best regards
igor
Hi Jimi
one can try to narrow down issue and test loop back PCM(SAI2)
without BT module, to check if issue is caused by BT module or i.MX.
For android OS with tinyalsa usage may be helpful:
VAR-SOM-MX6 Android Unit Testing - Variscite Wiki
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
HI igorpadykov
Does the setting of SAI2 to PCM correct(in devtree)? Or?
We use this 4 pins
MX8MM_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC <-> PCM_SYNC
MX8MM_IOMUXC_SAI2_TXC_SAI2_TX_BCLK <-> PCM_CLK
MX8MM_IOMUXC_SAI2_RXD0_SAI2_RX_DATA0<-> PCM_OUT
MX8MM_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0 <-> PCM_IN
Thanks