Audio Input issue with SGTL5000 audio codec

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

Audio Input issue with SGTL5000 audio codec

152 Views
AnjaliA
Contributor I

I am facing issue in recording audio via Mic IN. SGTL5000 is interfaced to imx8mnano.

I am using arecord to record the audio. Sample sample output I get:

root@imx8mn-lpddr4-evk:~# arecord -D hw:1,0 -r 48000 -f S16_LE -c 2 -d 10 /record.wav -vvv
Hardware PCM card 1 'sgtl5000-audio' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 24000
period_size : 6000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 6000
period_event : 0
start_threshold : 1
stop_threshold : 24000
silence_threshold: 0
silence_size : 0
boundary : 6755399441055744000
appl_ptr : 0
hw_ptr : 0
Recording WAVE '/record.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%

But the recording just has noise, no proper audio. Audio output to HPOUT jack is working fine.

Please suggest ways to check if the configuration is correct.

Below is the DTS changes done.

sound-sgtl5000{
compatible = "fsl,imx-audio-sgtl5000";
model = "sgtl5000-audio";
audio-cpu = <&sai3>;
audio-asrc=<&easrc>;
audio-codec = <&sgtl5000>;
audio-routing =
"MIC_IN", "Mic Jack",
"Mic Jack", "Mic Bias",
"Headphone Jack", "HP_OUT",
"Line Out Jack", "LINE_OUT";
mux-int-port = <2>;
mux-ext-port = <3>;
};

sgtl5000: codec@a {
compatible = "fsl,sgtl5000";
reg = <0xa>;
#sound-dai-cells = <1>;
clocks = <&clk IMX8MN_CLK_SAI3_ROOT>;
micbias-resistor-k-ohms = <2>;
micbias-voltage-m-volts = <2250>;
VDDA-supply = <&reg_module_3v3>;
VDDIO-supply = <&reg_module_3v3>;
VDDD-supply = <&reg_module_1v8>;
status = "okay";
};

 

Hoping to get a quick reply.

Labels (1)
0 Kudos
4 Replies

106 Views
AnjaliA
Contributor I

Any suggestions??

0 Kudos

100 Views
jimmychan
NXP TechSupport
NXP TechSupport

Could you tell me which version of BSP are you using?

Could you show me your board's device tree file?

0 Kudos

98 Views
AnjaliA
Contributor I
Hi Jimmychan,
 
We are using Yocto BSP 6.6-nanbield.
The DTS file changes done to enable I2c is:
sgtl5000: codec@a {
compatible = "fsl,sgtl5000";
reg = <0xa>;
#sound-dai-cells = <0>;
clocks = <&clk IMX8MN_CLK_SAI3_ROOT>;
micbias-resistor-k-ohms = <2>;
micbias-voltage-m-volts = <2250>;
VDDA-supply = <&reg_module_3v3>;
VDDIO-supply = <&reg_module_3v3>;
VDDD-supply = <&reg_module_1v8>;
status = "okay";
};
 
The DTS file change to enable i2s interface is as below:
sound-sgtl5000{
compatible = "fsl,imx-audio-sgtl5000";
    model = "sgtl5000-audio";
audio-cpu = <&sai3>;
audio-asrc = <&easrc>;
audio-codec = <&sgtl5000>;
audio-routing =
"MIC_IN", "Mic Jack",
                "Mic Jack", "Mic Bias",
"Headphone Jack", "HP_OUT",
"Line Out Jack", "LINE_OUT";
mux-int-port = <2>;
mux-ext-port = <3>;
};
With these changes I am able to get the sound card loaded and able to play audio via SGTL5000 HPOUT. But audio recording does not work. The .wav file gets created. But there is complete noise.
Am new to audio codec interfacing, any suggestions to debug this issue will be valuable.
 
Thanks
AnjaliA
0 Kudos

88 Views
jimmychan
NXP TechSupport
NXP TechSupport
0 Kudos