IMX8 Nano Slave SAI Clocks

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX8 Nano Slave SAI Clocks

Jump to solution
901 Views
millark
Contributor III

We have a custom IMX8 Nano based board (we have a few) however for the first time we are trying to configure the SAI5 interface as a clock slave to a DSP.

The device tree seems to parse ok and we do get our SAI device to work, however the clocks are not in sync and we assume it is because the SCLK and BLCK are not slaving correctly. We have tested them with a scope and the IMX8 is not generating clocks, the input clocks comming from the connected DSP are also fine under a scope.

Kernel 5.15.5

Here is the DTS fragments:

output {

compatible = "simple-audio-card";
simple-audio-card,name = "SAI5";
status="okay";

simple-audio-card,format="left_j";
simple-audio-card,frame-master = <&sound2codec>;
simple-audio-card,bitclock-master = <&sound2codec>;

sound2_sai: simple-audio-card,cpu {
sound-dai = <&sai5>;
dai-tdm-slot-num = <8>;
dai-tdm-slot-width = <32>;
};

sound2codec: simple-audio-card,codec {
sound-dai = <&codec_out>;
clocks = <&clk IMX8MN_CLK_SAI5_ROOT>;
};
};

codec_out: output_txcodec {
#sound-dai-cells = <0>;
#address-cells = <0>;
#size-cells = <0>;
compatible = "linux,spdif-dit";
status = "okay";
};

&sai5 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai5>;
assigned-clocks = <&clk IMX8MN_CLK_SAI5>;
assigned-clock-parents = <&clk IMX8MN_AUDIO_PLL1_OUT>;
assigned-clock-rates = <24576000>;
fsl,txmasterflag = <4>;
status = "okay";
};

Notice we are using the spdif-dit as the codec driver as we do not have a codec as such.

We set the txmasterflag to 4 which should set the TCR register. Well we have no clocks being generated so I guess this works.

 fsl,txmasterflag = <4>; // SND_SOC_DAIFMT_CBS_CFS

This should slave all clocks.

We also enabled  debug to the simple-audio-card driver, here is the dmesg on boot:

[ 4.735965] asoc-simple-card output: Card Name: SAI5
[ 4.735971] asoc-simple-card output: DAI0
[ 4.735976] asoc-simple-card output: cpu num = 1
[ 4.735980] asoc-simple-card output: cpu slots = 8
[ 4.735986] asoc-simple-card output: cpu slot width = 32
[ 4.735995] asoc-simple-card output: cpu sysclk = 400000000Hz
[ 4.736001] asoc-simple-card output: cpu direction = IN
[ 4.736006] asoc-simple-card output: codec num = 1
[ 4.736011] asoc-simple-card output: codec clk 24576000Hz
[ 4.736017] asoc-simple-card output: codec sysclk = 24576000Hz
[ 4.736022] asoc-simple-card output: codec direction = IN
[ 4.736027] asoc-simple-card output: dai name = 30050000.sai-dit-hifi
[ 4.736031] asoc-simple-card output: dai format = 1003

All audio playback using aplay or speaker-test is scratchy and not clock synced correctly.

How can we diagnose in linux the bclock and sclock being received?

Any help would be appreciated here.

 

0 Kudos
Reply
1 Solution
828 Views
millark
Contributor III

Thanks, this was solved by using the correct fsl,txmasterflag;

View solution in original post

0 Kudos
Reply
2 Replies
829 Views
millark
Contributor III

Thanks, this was solved by using the correct fsl,txmasterflag;

0 Kudos
Reply
864 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Dear Ed Stark,

Just to confirm, your processor is receiving data from DSP correctly, but your processor is not sending data to de DSP.

Do you follow Section 13.1.1.3.1 SAI Master Clock Inputs/Outputs from Reference Manual? There is detailed information about using input signal from external devices on SAI module.

Best regards.

0 Kudos
Reply