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.

SK-AM62: Audio Codec aix31xx wait bits failed.

Part Number: SK-AM62
Other Parts Discussed in Thread: TLV320AIC3111

Hello, I am using SK-AM62 eval board. 

and trying to run loopback audio using g-streamer and seems to get the following error after 5mins of running the loopback test. 

command to run loopback testing:

$> gst-launch-1.0 -v autoaudiosrc ! audioconvert ! autoaudiosink

and on different terminal 

$> pulseaudio -vvvvvvv

log:

root@am62xx-evm:~# dmesg | grep -i codec
[ 29.850900] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x24 was 0x60 expected 0x0 (0, 0x40, 500000 us)
[ 29.861265] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: ADC event failed: -1
[ 30.804532] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x24 was 0x60 expected 0x0 (0, 0x40, 500000 us)
[ 30.814913] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: ADC event failed: -1
[ 32.122496] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x24 was 0x60 expected 0x0 (0, 0x40, 500000 us)
[ 32.132865] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: ADC event failed: -1
[ 33.032529] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x24 was 0x60 expected 0x0 (0, 0x40, 500000 us)
[ 33.042911] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: ADC event failed: -1
[ 33.872538] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x24 was 0x60 expected 0x0 (0, 0x40, 500000 us)
[ 33.882921] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: ADC event failed: -1
[ 34.843380] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x24 was 0x60 expected 0x0 (0, 0x40, 500000 us)
[ 34.853749] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: ADC event failed: -1
[ 696.166647] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x25 was 0x88 expected 0x0 (0, 0x80, 500000 us)
[ 696.177020] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: DAC Left event failed: -1
[ 697.269453] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x25 was 0x88 expected 0x0 (0, 0x8, 500000 us)
[ 697.279735] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: DAC Right event failed: -1
root@am62xx-evm:~#

  • Hi, Guy

    Can you mesrue the bck and ws clk during runing loopback test?

  • Hello, 

    following are the clock or running but no audio on loopback. 

    mclk = 12.02MHz

    bclk = 1.4MHz

    wclk = 45.1KHz

  • HI Shenghao, I know this is separate question, can you tell me how to change the audio codec sampling frequenct from default 44.1KHz to 48KHz? please 

    in Linux? 

  • So, the sequence is as follows:

    1. Run pulseaudio and the clock mclk,wclk, bclk are on. 

    2. Run g-streamer in loopback mode. 

    3. get error on consol:

    110.296154] davinci-mcasp 2b10000.mcasp: Receive buffer overflow
    [ 110.307741] davinci-mcasp 2b10000.mcasp: Receive buffer overflow
    [ 110.314596] davinci-mcasp 2b10000.mcasp: Receive buffer overflow
    [ 110.321489] davinci-mcasp 2b10000.mcasp: Receive buffer overflow
    [ 110.328458] davinci-mcasp 2b10000.mcasp: Receive buffer overflow
    [ 110.335419] davinci-mcasp 2b10000.mcasp: Receive buffer overflow
    [ 110.346960] davinci-mcasp 2b10000.mcasp: Receive buffer overflow
    [ 110.353838] davinci-mcasp 2b10000.mcasp: Receive buffer overflow
    [ 110.360811] davinci-mcasp 2b10000.mcasp: Receive buffer overflow
    [ 110.367923] davinci-mcasp 2b10000.mcasp: Receive buffer

    4. log from pulseaudio

    ...320aic31xx-hifi-0] alsa-util.c: PCM state is XRUN
    320aic31xx-hifi-0] alsa-source.c: Starting capture.
    C0 is accessible: yes
    ks and sources of card alsa_card.platform-soundcard.
    0aic31xx-hifi-0] alsa-sink.c: Trying resume...
    0aic31xx-hifi-0] alsa-util.c: Trying to disable ALSA period wakeups, using timers only
    0aic31xx-hifi-0] alsa-util.c: Maximum hw buffer size is 2972 ms
    0aic31xx-hifi-0] alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Invalid argument
    320aic31xx-hifi-0] alsa-util.c: Got POLLERR from ALSA
    320aic31xx-hifi-0] alsa-util.c: Got POLLIN from ALSA
    320aic31xx-hifi-0] alsa-util.c: PCM state is XRUN
    320aic31xx-hifi-0] alsa-source.c: Starting capture.
    0aic31xx-hifi-0] alsa-util.c: Set period size first (to 13505 samples), buffer size second (to 81033 samples).
    0aic31xx-hifi-0] alsa-util.c: Device hw:0 doesn't support 48000 Hz, changed to 44100 Hz.
    0aic31xx-hifi-0] alsa-util.c: ALSA period wakeups disabled
    0aic31xx-hifi-0] alsa-sink.c: Resume failed, couldn't restore original sample settings.
    320aic31xx-hifi-0] alsa-util.c: Got POLLERR from ALSA
    320aic31xx-hifi-0] alsa-util.c: Got POLLIN from ALSA
    320aic31xx-hifi-0] alsa-util.c: PCM state is XRUN
    320aic31xx-hifi-0] alsa-source.c: Starting capture.
    hannel.
    C0 is accessible: yes
    ks and sources of card alsa_card.platform-soundcard.
    0aic31xx-hifi-0] alsa-sink.c: Trying resume...
    0aic31xx-hifi-0] alsa-util.c: Trying to disable ALSA period wakeups, using timers only
    0aic31xx-hifi-0] alsa-util.c: Maximum hw buffer size is 2972 ms
    0aic31xx-hifi-0] alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Invalid argument
    320aic31xx-hifi-0] alsa-util.c: Got POLLERR from ALSA
    320aic31xx-hifi-0] alsa-util.c: Got POLLIN from ALSA
    320aic31xx-hifi-0] alsa-util.c: PCM state is XRUN
    320aic31xx-hifi-0] alsa-source.c: Starting capture.
    0aic31xx-hifi-0] alsa-util.c: Set period size first (to 13505 samples), buffer size second (to 81033 samples).
    0aic31xx-hifi-0] alsa-util.c: Device hw:0 doesn't support 48000 Hz, changed to 44100 Hz.
    0aic31xx-hifi-0] alsa-util.c: ALSA period wakeups disabled
    0aic31xx-hifi-0] alsa-sink.c: Resume failed, couldn't restore original sample settings.
    320aic31xx-hifi-0] alsa-util.c: Got POLLERR from ALSA
    320aic31xx-hifi-0] alsa-util.c: Got POLLIN from ALSA
    320aic31xx-hifi-0] alsa-util.c: PCM state is XRUN
    320aic31xx-hifi-0] alsa-source.c: Starting capture.
    C0 is accessible: yes...

  • Hi Mitesh,

    Which part number you used ?

    The 48khz should be automatically selected when play 48khz audio, See the previous log, The register status indicates that the ADC & DAC is not shutting down as expected, is there any sound to playback or capture?

    Regarding to the log of "Receive buffer overflow" you should increase the minBufferSize.

    Thanks

  • Hi Kevin, we are using TLV320AIC3111. When we do 'pactl list sources' the default rate is 44100 and not 48000. and when I change the config file to use 48000 it says not supported to change the rate. 

    Could you please let me know how to increase the buffers please? 

    Thanks 

  • Hi Mitesh,

    First of all, Our driver can support 48k. Your log shows the PCM state is XRUN, the XRUN means under run or over run, I think it's related to buffer size, you can add ~/.asoundrc file to user path to config buffersize and sample rate. Here's an example, you can find some resource for learning to config and use ~/.asoundrc file

     

    pcm.!default{
            type asym
            playback.pcm {
                    type plug
                    slave {
                            pcm "hw:0,2"
                            channels 2  
                            period_size 1024  
                            buffer_size 4096  
                            rate 48000
                            periods 0  
                            period_time 0
                    }
            }
            capture.pcm {
                    type plug
                    slave {
                            pcm "hw:1,0"
                            channels 2  
                            period_size 1024  
                            buffer_size 4096  
                            rate 48000  
                            periods 0  
                            period_time 0
                    }
            }
    
    }

    Thanks

  • Thanks Kevin, I shall try this. Cheers. 

  • Hi Kevin, when I try the following config in asoundrc 

    pcm.primary {
            type hw
            card 0
            device 0
    }
    I get error:
    root@am62xx-evm:~# aplay -D primary /usr/share/sounds/alsa/Front_Center.wav Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
    aplay: set_params:1347: Channels count non available
    root@am62xx-evm:~#
  • HI Kevin, when I set the asoundrc file to the following 

    pcm.!default{
            type asym
            playback.pcm {
                    type plug
                    slave {
                            pcm "hw:0,0"
                            channels 2  
                            rate 48000
                    }
            }
            capture.pcm {
                    type plug
                    slave {
                            pcm "hw:0,0"
                            channels 2  
                            rate 48000
                    }
            }

    }

    and try to run loopback g-streamer I get the following error:

    I: [alsa-sink-davinci-mcasp.0-tlv320aic31xx-hifi tlv320aic31xx-hifi-0] alsa-util.c: Device hw:0 doesn't support 48000 Hz, changed to 44100 Hz.

  • Hi Mitesh,

    Maybe the file is not working. Make sure the file is placed in ~/, then use command 'arcord -L' to reload the file.

    Thanks


  • root@am62xx-evm:~# arecord -L
    null
    Discard all samples (playback) or generate zero samples (capture)
    sysdefault:CARD=AM62xSKEVM
    AM62x-SKEVM, davinci-mcasp.0-tlv320aic31xx-hifi tlv320aic31xx-hifi-0
    Default Audio Device


    root@am62xx-evm:~# ls -l /home/root/.asoundrc
    -rw-r--r-- 1 root root 453 Jul 26 10:21 /home/root/.asoundrc

    log from pulseaudio 

    D: [pulseaudio] alsa-util.c: snd_pcm_dump():
    D: [pulseaudio] alsa-util.c: Hardware PCM card 0 'AM62x-SKEVM' device 0 subdevice 0
    D: [pulseaudio] alsa-util.c: Its setup is:
    D: [pulseaudio] alsa-util.c: stream : PLAYBACK
    D: [pulseaudio] alsa-util.c: access : MMAP_INTERLEAVED
    D: [pulseaudio] alsa-util.c: format : S16_LE
    D: [pulseaudio] alsa-util.c: subformat : STD
    D: [pulseaudio] alsa-util.c: channels : 2
    D: [pulseaudio] alsa-util.c: rate : 44100
    D: [pulseaudio] alsa-util.c: exact rate : 44100 (44100/1)
    D: [pulseaudio] alsa-util.c: msbits : 16
    D: [pulseaudio] alsa-util.c: buffer_size : 88200
    D: [pulseaudio] alsa-util.c: period_size : 14700
    D: [pulseaudio] alsa-util.c: period_time : 333333
    D: [pulseaudio] alsa-util.c: tstamp_mode : ENABLE
    D: [pulseaudio] alsa-util.c: tstamp_type : MONOTONIC
    D: [pulseaudio] alsa-util.c: period_step : 1
    D: [pulseaudio] alsa-util.c: avail_min : 87319
    D: [pulseaudio] alsa-util.c: period_event : 0
    D: [pulseaudio] alsa-util.c: start_threshold : -1
    D: [pulseaudio] alsa-util.c: stop_threshold : 6206523236469964800
    D: [pulseaudio] alsa-util.c: silence_threshold: 0
    D: [pulseaudio] alsa-util.c: silence_size : 0
    D: [pulseaudio] alsa-util.c: boundary : 6206523236469964800
    D: [pulseaudio] alsa-util.c: appl_ptr : 0
    D: [pulseaudio] alsa-util.c: hw_ptr : 0

  • Hi Mitesh,

    I think that's because the channel count is stereo, not mono. you should change a wav file, 

    Thanks

  • Hi Mitesh,

    could you exit the root? From the log, I didn't see the modification works, 

    pcm.rate_convert {
    	type rate
    	slave {
    		pcm "hw:0,0"
    		rate 48000
    	}
    }

    Kindly set asoundrc as above and see if it can works.

    Thanks
  • Hi Kevin, we don't have any other user on the system just root.

    What are the steps to make sure we are using the .asoundrc file ?

    All I am doing is moving the file to ~/.asoundrc on the system and rebooting the system. 


  • root@am62xx-evm:~# aplay /usr/share/sounds/alsa/Front_Center.wav
    Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono


    root@am62xx-evm:~# aplay -L
    null
    Discard all samples (playback) or generate zero samples (capture)
    default:CARD=AM62xSKEVM
    AM62x-SKEVM, davinci-mcasp.0-tlv320aic31xx-hifi tlv320aic31xx-hifi-0
    Default Audio Device
    sysdefault:CARD=AM62xSKEVM
    AM62x-SKEVM, davinci-mcasp.0-tlv320aic31xx-hifi tlv320aic31xx-hifi-0
    Default Audio Device


    root@am62xx-evm:~# arecord -L
    null
    Discard all samples (playback) or generate zero samples (capture)
    default:CARD=AM62xSKEVM
    AM62x-SKEVM, davinci-mcasp.0-tlv320aic31xx-hifi tlv320aic31xx-hifi-0
    Default Audio Device
    sysdefault:CARD=AM62xSKEVM
    AM62x-SKEVM, davinci-mcasp.0-tlv320aic31xx-hifi tlv320aic31xx-hifi-0
    Default Audio Device
    root@am62xx-evm:~#

  • It seems that the error log never happens again, is there a sound playing?

    Thanks

  • Hi Kevin, no really. when I use the pulseaudio and g-streamer, I still get error to say, hardware sound card can only work at 44100 and not 48000.

    Thanks 

  • Hi Mitesh,

    If that so, I think the issue is caused by the truly clock, you see the wclk is 45.1KHz, it will cause clock error, could you send out the registers dump during playback? we can locate whether this is an issue caused by the register configuration.

    Thanks

  • Hi Kevin, I shall try to send you the reg dump today, how would you change the buffer size please? 

  • Hi Mitesh,

    Same as the method of changing sample rate, you can add  buffer_size = 4096(or bigger) in .asoundrc, 

    Thanks

  • Hi Kevin, attached is the reg dump after aplay. Thanks 

    root@am62xx-evm:~# aplay /usr/share/sounds/alsa/Front_Center.wav
    Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono


    root@am62xx-evm:~# i2cdump -y -f 1 0x18
    No size specified (using byte-data access)
    0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    00: 00 00 01 56 03 91 08 07 80 00 00 88 82 00 80 80 ..?V?????..??.??
    10: 08 00 88 82 80 80 04 00 00 00 01 4c 00 04 88 00 ?.?????...?L.??.
    20: 00 00 00 00 80 bb 11 00 00 00 00 00 00 00 00 00 ....???.........
    30: 00 00 00 02 32 12 03 02 02 11 10 00 01 04 00 d4 ...?2??????.??.?
    40: 0c 00 00 00 6f 38 00 00 00 00 00 ee 10 d8 7e e3 ?...o8.....???~?
    50: 00 00 00 00 00 00 a0 fe 50 30 20 00 00 00 00 00 ......??P0 .....
    60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    70: 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 .....?..........
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    root@am62xx-evm:~#

  • Hi Mitesh,

    Thanks for the information, we can confirm that the PLL configuration is correct, the WCLK should be 48khz, but it's not. The problem looks like it's because of wrong MCLK input, would double check this? The system detected the wrong BCLK clock, so the mute function was not called.

    Thanks

  • Thanks Kevin. I will check that.

    But not sure why did the change of sampling rate and adding min buffer size doesn't work when I use the suggested asoundrc settings please. 

  • Hi Mitesh,

    Sorry for late, I think the sample rate depends on whether the hardware can meet the setting, and the buffer size should work if it's within tolerance.

    Thanks