cancel
Showing results for 
Search instead for 
Did you mean: 

stm32mp1 sai synchronous slave

jacob-sorber
Associate

Hi

I have stm32mp157c in my custom board i connect sai2 to codec(tlv320aic), i config sai2a as master (WITHOUT MASTER CLK OUTPUT) and sai2b as synchronous slave, mclk for codec come from rcc mco1 and this is my dts:

 

 

sound {
// compatible = "audio-graph-card", "simple-audio-card";
compatible = "audio-graph-card";
label = "AUDIOcard1";

routing =
"Playback" , "MCLK",
"Capture" , "MCLK";
dais = <&sai2a_port &sai2b_port>;
status = "okay";
};

sai2a:audio-controller@4400b004{
status = "okay";

/* USER CODE BEGIN sai2a */
dma-names = "tx";
// #clock-cells = <0>;
clocks = <&rcc SAI2_K>;
clock-names = "sai_ck";
 
frame-master;
bitclock-master;
 
sai2a_port: port {
sai2a_endpoint: endpoint {
remote-endpoint = <&tlv320_tx_endpoint>;
format = "i2s";
};
};
/* USER CODE END sai2a */
};

sai2b:audio-controller@4400b024{
status = "okay";

/* USER CODE BEGIN sai2b */
dma-names = "rx";
st,sync = <&sai2a 2>; /* Set SAI2B as slave of SAI2A. */

clocks = <&rcc SAI2_K>, <&sai2a>;
clock-names = "sai_ck", "NCLK";
 
sai2b_port: port {
sai2b_endpoint: endpoint {
remote-endpoint = <&tlv320_rx_endpoint>;
format = "i2s";
};
};

codec: tlv320aic32x4@18 {
compatible = "ti,tlv320aic32x4";
reg = <0x18>;
clocks = <&rcc CK_MCO1>;
clock-names = "MCLK";
ldoin-supply = <&v3v3>;
reset-gpios = <&gpioi 0 GPIO_ACTIVE_LOW>;
#sound-dai-cells = <0>;
status = "okay";
port {
#address-cells = <1>;
#size-cells = <0>;
tlv320_tx_endpoint: endpoint@0 {
reg = <0>;
remote-endpoint = <&sai2a_endpoint>;
};
tlv320_rx_endpoint: endpoint@1 {
reg = <1>;
remote-endpoint = <&sai2b_endpoint>;
};
};
 
now my tx path is ok and i can play sound but rx path for capture has some issue when run arecord
board ># arecord -D hw:0,1 -f S16_LE -c 2 -r 44100 -d 5 test.wav
arecord: pcm_read:2151: read error: Input/output error


i see in rx path bitclock and word clock desn't generate (from stm32mp1)
how should i config dts for this situation that can have sai2a as master WITHOUT MASTER CLOCK OUT and sai2b as synchronous slave
i read this thread:
0 REPLIES 0