IMX8M-mini : (TDM) How to generate SAI frame Sync from bitclock ?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

IMX8M-mini : (TDM) How to generate SAI frame Sync from bitclock ?

11,563件の閲覧回数
clement_duval
Contributor II

Hello everybody,

I am using the iMX8M-mini to acquire sound from 16 TDM microphones (ics52000).
I am using an external codec to drive a very low-jitter bitclock which is meant to go on both ics52000 and iMX8. However this external codec is not able to generate a frame clock based on 16 channels so I have to do this inside iMX8.

Bellow my device tree (sorry I did'nt find how to include code so I put an image)

Capture d’écran de 2019-05-28 10-09-28.png

For information my mics are working well if I generate bitclock and frame clock from internal IMX8 codec without external codec : (mode SND_SOC_DAIFMT_CBM_CFM)
   simple-audio-card,bitclock-master = <&imx8_dai>
   simple-audio-card,frame-master = <&imx8_dai>
Moreover if I try the mode SND_SOC_DAIFMT_CBM_CFS only the bitclock is generated in that mode

   simple-audio-card,bitclock-master = <&imx8_dai>
   simple-audio-card,frame-master = <&ics52000>

I don't know what i missed, my bitclock seems clean but it looks like the SAI don't manage to generate frameclock based on it.

For now I am trying 8kHz sample rate which gave me a 4.096MHz bitclock.

SCRN0327.PNG

Hope you can help me on this issue.

Thanks,

Clément Duval

ラベル(3)
タグ(3)
0 件の賞賛
返信
9 返答(返信)

10,590件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Clément 

"simple-audio-card" is not supported in i.MX8 NXP BSPs, but

one can try to debug it, checking registers TCR4, RCR4, fields FSD, FRSZ,

pay attention tosect.13.9.3.3 Synchronous modes,

sect.13.9.3.4 Frame sync configuration i.MX8MM Reference Manual.

Use Chapter 7 Audio attached Linux Manual for description of sai drivers.

Recommended to test with NXP Linux from codeaurora :
https://source.codeaurora.org/external/imx/linux-imx/tree/?h=imx_4.14.98_2.0.0_ga

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

10,590件の閲覧回数
clement_duval
Contributor II

Hi Igor,

I found the solution to my problem. I needed the Receiver to be asynchronous. The RCR2 bit 31 tickle me.

I added fsl,asynchronous to my SAI config in the device tree

&sai3 {
   #sound-dai-cells = <0>;
    pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_sai3>;
   assigned-clocks = <&clk IMX8MM_CLK_SAI3_SRC>,
   <&clk IMX8MM_CLK_SAI3_ROOT>;
   assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
   assigned-clock-rates = <0>, <131072000>;
   status = "okay";
   fsl,sai-asynchronous;
};

Thank you for your help ,

Clément Duval

0 件の賞賛
返信

10,590件の閲覧回数
malays
Contributor I

Hi Clément Duval, 

I am working with iMX8M MINI dev board to interface Multi channel Stereo audio. I need some help on the TDM interface with iMX8M mini board. I changed the device tree with the help of reference screen shot you have shared. 

Can you help me with how to record those TDM audio stream to the iMX8 board and separate those multi channels. I am working with 2 stereo audio (4 ADC) input with PCM1865 analog audio codec to get the sinlge TDM audio which is fed to iMX8M sai3 port.  

0 件の賞賛
返信

10,590件の閲覧回数
clement_duval
Contributor II

Hi Malay,

I think your next step will be the integration of your new sound card in Alsa. I don't know what type of project you are using but you need to configure ALSA asound.conf like this one (be aware this is on an other project and must fit your devicetree)

pcm.!default {     type plug     slave.pcm {         @func getenv         vars [ ALSAPCM ]         default "hw:imx8tdmqcc"     } }

Hope this can helps you.

Best Regards,

0 件の賞賛
返信

10,590件の閲覧回数
malays
Contributor I

Hi Clément Duval,

Thank you for your quick response, i really appreciate your help. 

I have more concern about how to record the TDM audio and separate them into two stereo channel. 

e.g. For single channel i used arecord and aplay commands to record and play the audio. 

How that works in TDM mode configuration. 

Thanks.!

0 件の賞賛
返信

10,590件の閲覧回数
clement_duval
Contributor II

Hi Malay,

arecord is a good place to start, please look at option -c channel

number. You will find the answer to your question.

Best Regards,

Clément

0 件の賞賛
返信

10,590件の閲覧回数
malays
Contributor I

Hi Clément, 

I am able to record the multi channel audio (2 stereo channel) with the help of arecord. 

Can you help me with the splitting of those channels into 2 stereo channel and how to listen to those separate channels. I guess i have to use ALSA plugins but not sure how this will be integrated. 

I really appreciate your inputs. 

0 件の賞賛
返信

10,590件の閲覧回数
clement_duval
Contributor II

Hi Malay,

Once you have recorded the file, you can import it into your computer

and open the file with audacity. You will be able to listen to the

channel you want and do all the processing you need. I don't know much

about audacity, my expertise stops here.

Best Regards,

Clément

0 件の賞賛
返信

10,590件の閲覧回数
clement_duval
Contributor II

Thank you for your help, I checked my registers and something seems wrong. I will check this and get back to you :

TCR2 = 00000000000000000000000000000000
TCR3 = 00000000000000000000000000000000
TCR4 = 00000000000000000000000000011001
RCR2 = 01000000000000000000000000000000
RCR3 = 00000000000000000000000000000000
RCR4 = 00000000000011110001111100111001

(RCR4 bit 20 should 1 instead of 0 to have 32 bits / word)

0 件の賞賛
返信