This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: AudioCodec TLV320AIC3212 device is not working with any frequency except 44100Hz

Part Number: AM5728
Other Parts Discussed in Thread: TLV320AIC3212,

Hello,

We are in a process of porting TLV320AIC3212 AudioCodec with AM5728 based custom board and using the AudioCodec 3262 driver file ( as suggested on forum 3262 files can be used for 3212 AudioCodec). 

tlv320aic326x.c

tlv320aic326x.h

Observations:

1. While recording any input using arecord command with any frequency 16000 / 22050 Hz rate, the recorded file sample.wav is played on the same SOC using aplay command, it is playing the recorded sound but with so much noise. However, when the same file is transferred to a Laptop/PC, it is not playing properly and the time duration of the recorded file sample.wav is also increased.

2. When the same observation is taken with 44100 HZ, it is working perfectly fine at the same SoC and also on the PC/Laptop.

3. Also, while recording any input using arecord command with any frequency 16000 Hz rate, it seems internally it is recording at 11025 Hz. Please look at the logs below:

root@am57xx-evm:~# arecord -f cd -c 1 -r 16000 /home/root/bin/sample.wav 
Recording WAVE '/home/root/bin/sample.wav' : [  106.298553]  
[  106.298553]  Inide soc_dai_hw_params
Signed 16 bit Little Endian, Rate 16000 Hz, Mono
[  106.305518] #aic3262_multi_i2s_hw_params: Invoked for ASI1 Port for Record Mode
[  106.317622] #aic3262_get_divs: Found Entry 6 in Clock_Array
[  106.323218] rate = 11025 
[  106.327818] starting i2c_verify
[  106.332707] Resetting page to 0
[  106.337557] #aic3262_set_bias_level: Codec Active 1[0]
[  106.343316] #aic3262_multi_i2s_hw_params: None of the ASIs active yet...
[  106.350747] # reading NDAC = 8 , NDAC_DIV_POW_REG = 1
[  106.356110] # writing NDAC = 8 , NDAC_DIV_POW_REG = 8
[  106.361302] # reading MDAC = 8 , MDAC_DIV_POW_REG = 4
[  106.367780] # writing MDAC = 8 , MDAC_DIV_POW_REG = 8
[  106.372949] # writing DOSR_MSB_REG = 0
[  106.377088] # writing DOSR_LSB_REG = 128
[  106.381124] # writing NADC_DIV_POW_REG = 8
[  106.385660] # writing MADC_DIV_POW_REG = 8
[  106.389872] # writing AOSR = 128
[  106.393308] #aic3262_multi_i2s_hw_params: Reading Pg 4 Reg 1 for Bus Format Control.
[  106.401582] #aic3262_multi_i2s_hw_params: Configuring ASI1 S16_LE Fmt..
[  106.408775] #aic3262_set_bias_level: Codec Active 1[0]
[  106.414766] aic3262_asi1_clk_config: Invoked
[  106.419151] 
[  106.419151]  wclk output control reg = 80 
[  106.425505]  
[  106.425505]  Inide soc_dai_hw_params
[  106.430676] davinci-mcasp 48468000.mcasp: Too fast reference clock (24000000)
[  106.438536] davinci-mcasp 48468000.mcasp: Sample-rate is off by 400 PPM
[  106.446078] #aic3262_set_bias_level: Codec Active 1[1]
[  106.452096] #aic3262_set_bias_level: Codec Active 1[1]
[  106.457565] #aic3262_set_bias_level: Another Stream Active. No STANDBY
[  106.464260] #aic3262_set_bias_level: Codec Active 1[1]

Queries:

1. Why the device is not working with any other frequency except 44100 Hz?

2. Since, the duration of the sample.wav recorded file increases after transferring it to PC/Laptop, it seems internally, it is practically recording at 44100 Hz only, but in the audio file metadata it is storing the frequency value passed as a parameter, say 16000 or 22050Hz, and that is why when played on PC, it is getting corrupted. Am I correct?

Kindly provide a resolution to the above queries.

Regards 

Sahil Kalra