imx6DL 與 TC358743 ADU 介面只有採用Transmit 0/receive 3 mode,線路RXD/RXFS/RXCLK
RXFS(48KHZ) and RXCLK(3Mhz) 都由TC358743 產生,RXD 也有訊息
有關audio dts 設定如下
sound-hdmi-input {
compatible = "fsl,imx-audio-tc358743";
cpu-dai = <&ssi2>;
model = "imx-audio-tc358743";
mux-int-port = <2>;
mux-ext-port = <5>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux_tc358743>;
status = "okay";
};
&ssi2 {
status = "okay";
};
pinctrl_audmux_tc358743: audmux-tc358743grp {
fsl,pins = <
MX6QDL_PAD_DISP0_DAT13__AUD5_RXFS 0x130b0
MX6QDL_PAD_DISP0_DAT14__AUD5_RXC 0x130b0
MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x130b0
>;
};
在TC358743 source code Audio hw_params 相關設定如下
snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF |
SND_SOC_DAIFMT_CBM_CFM);
snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM);
snd_soc_dai_set_sysclk(codec_dai, 0,CODEC_CLOCK, SND_SOC_CLOCK_OUT);
snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffc, 0xffffffc, 2, 0);
snd_soc_dai_set_sysclk(cpu_dai, IMX_SSP_SYS_CLK, 0,SND_SOC_CLOCK_IN);
ptcr=[0xe739c800] pdcr=[0x8000]
debug log
root@FA30H_HW100:/proc/asound/card1/pcm0c # dmesg | grep -A15 tc358743-hifi
imx-tc358743 sound-hdmi-input: tc358743-hifi <-> 202c000.ssi mapping ok
rtc-m41t80 2-0068: setting system clock to 2018-05-10 11:29:19 UTC (1525951759)
VGEN1: disabling
SW4: disabling
usb_otg_vbus: disabling
ALSA device list:
#0: imx-hdmi-soc
#1: imx-audio-tc358743
tc358743 hdmi input audio 與 202c000.ssi mapp ok
tc358743 Audio 為 pcmC1D0c
使用tinycap 對 pcmC1D0c 進行錄音動作,但並無抓取任何資料
/sdcard/Music/hdmi_test.wav -D 1 -d 0 -r 48000 -c 2 <
Capturing sample: 2 ch, 48000 hz, 16 bit
Captured 0 frames
請問是那裡沒有設定成確,造成無法進行錄音,
是否有相關真對audio只使用Receive mode(RXD/RXFS/RXCLK) 設定文件。
HI Frank,
我的audmux和pinmux设置如下:
MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
MX6QDL_PAD_CSI0_DAT10__AUD3_RXC 0x130b0
MX6QDL_PAD_CSI0_DAT11__AUD3_RXFS 0x130b0
sound-tef6638-capture {
compatible = "fsl,imx-pcm-capture";
model = "imx-tef6638-capture";
ssi-controller = <&ssi1>;
audio-codec = <&pcm_capture>;
mux-int-port = <1>;
mux-ext-port = <3>;
};
static int imx_audmux_config(int slave, int master)
{
unsigned int ptcr, pdcr;
/*
* The port numbering in the hardware manual starts at 1, while
* the audmux API expects it starts at 0.
*/
slave = slave - 1;
master = master - 1;
ptcr = IMX_AUDMUX_V2_PTCR_SYN |
IMX_AUDMUX_V2_PTCR_TFSDIR |
IMX_AUDMUX_V2_PTCR_TFSEL(master) |
IMX_AUDMUX_V2_PTCR_TCLKDIR |
IMX_AUDMUX_V2_PTCR_TCSEL(master);
pdcr = IMX_AUDMUX_V2_PDCR_RXDSEL(master);
imx_audmux_v2_configure_port(slave, ptcr, pdcr);
ptcr = IMX_AUDMUX_V2_PTCR_SYN;
pdcr = IMX_AUDMUX_V2_PDCR_RXDSEL(slave);
imx_audmux_v2_configure_port(master, ptcr, pdcr);
return 0;
}
采样率44100,格式S16_LE,MCU一侧已经把TEF6638寄存器配置好了,BLCK和WS以及DATA信号都有,BLCK频率2.822M,WS信号44.1K都是对的,因此也不需要SOC这边去设置codec_dai的sys clock:
static int imx_tef6638_capture_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
unsigned int channels = params_channels(params);
int ret = 0;
u32 dai_format;
printk("imx_tef6638_capture_hw_params\n");
dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM;
/* set cpu DAI configuration */
ret = snd_soc_dai_set_fmt(cpu_dai, dai_format);
if (ret < 0) {
printk("imx_tef6638_capture_hw_params: snd_soc_dai_set_fmt(cpi_dai) error!\n");
return ret;
}
/* set i.MX active slot mask */
ret= snd_soc_dai_set_tdm_slot(cpu_dai,
channels == 1 ? 1 : 3, //0xfffffffe : 0xfffffffc,
channels == 1 ? 1 : 3, //0xfffffffe : 0xfffffffc,
2, 32);
if (ret < 0) {
printk("imx_tef6638_capture_hw_params: snd_soc_dai_set_tdm_slot error!\n");
return ret;
}
/* set the SSI system clock as input */
ret = snd_soc_dai_set_sysclk(cpu_dai, 0, 0, SND_SOC_CLOCK_IN);
if (ret < 0) {
printk("imx_tef6638_capture_hw_params: snd_soc_dai_set_sysclk error!\n");
return ret;
}
// snd_soc_dai_set_sysclk(codec_dai, 0, 44100 * 64, SND_SOC_CLOCK_OUT);
return 0;
}
声卡已经有了:
[ 3.501166] tef6638-capture pcm_capture: TEF6638 Audio capture
[ 3.513278] fsl-asrc 2034000.asrc: driver registered
[ 3.515650] imx-tef6638-capture sound-tef6638-capture: imx_tef6638_capture_probe
[ 3.517768] imx-tef6638-capture sound-tef6638-capture: tef6638-capture <-> 2028000.ssi mapping ok
[ 3.518563] imx-tef6638-capture sound-tef6638-capture: snd_soc_register_card ok for tef6638 capture
只是在录音的时候会有"arecord: pcm_read:1828: read error: Input/output error."这个错误
实在是想不通还有什么地方不对。
HI Frank,
还有什么建议吗?
問題已解~~
原因AUD2 to SSI2 routing 有誤,加上TC358743 Audio 也需修改
HI Frank Weng,
我现在跟你一样ssi作为slave,tef6638作为master提供BCLK和WS信号。
但是在录音的时候arecord -Dplughw:0,0 -c 2 -r 44100 -f S16_LE -d 5 /tmp/record.wav,
出现错误告警:
arecord: pcm_read:1828: read error: Input/output error.
你之前说“AUD2 to SSI2 routing 有誤”,请问这部分是修改哪里,如何修改呢?
谢谢!
LevisLi
我只有使用RXC and RXFS 的訊號,AUD2 到 SSI2 routing ,請你去看Data Sheet 第16章Digital Audio Multiplexer (AUDMUX) 及第61章Synchronous Serial Interface (SSI),AUDMUX 與 SSI 都他必須設定的方向
是否有人可以協助,imx6dl + TC358743 audio 依然無法動作
imx6dl I2S 設為slave,TC358743 I2S 設定master
root@:/d/audmux # cat ssi1
PDCR: 00008000
PTCR: 6318c000
TxFS input, TxClk input
RxFS input, RxClk input
Data received from SSI5
root@:/d/audmux # cat ssi4
PDCR: 00008000
PTCR: 6318c000
TxFS input, TxClk input
RxFS input, RxClk input
Data received from SSI5
5. 開機也有出現” imx-tc358743 sound-hdmi-input: tc358743-hifi <-> 202c000.ssi mapping ok” 的訊息,使用tinycap 來抓去audio ,結果是抓不到資訊。
是否有那裡設定錯誤,造成無法抓取聲音
謝謝!!協助幫忙~~~