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.

Mcasp 24bit i2s support

Hi,

I am working on the codec which is 24bit i2s format, the codec is connected to mcasp2 & I have plugged in this codec in mcasp driver,

I have configured the codec path's correctly but I dont get any sound.

Does mcasp support 24 bit i2s format ?

I have changed

#define AUDIO_FORMAT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM)

in davicni mcasp driver.

Thanks And Regards,

Mike

  • Hi Pavel,

    Thanks for the pointers!

    I tried the following to get with something on existing mcasp driver and use 16 bit, when i use arecord get following error:

    root@dm814x-evm:~# arecord -D 'hw:0,0' -r 48000 -d 10 -f dat song.dat
    Recording WAVE 'song.dat' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    arecord: pcm_read:2031: read error: Input/output error

    Any pointers where to debug this ?

    I also tried with gstreamer:

    root@dm814x-evm:~# gst-launch-1.0 -v alsasrc ! audio/x-raw,rate=48000,channels=2 ! alsasink
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstAudioSrcClock
    /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: actual-buffer-time = 200000
    /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: actual-latency-time = 10000
    /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0.GstPad:src: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)48
    000\,\ channels\=\(int\)2\,\ channel-mask\=\(bitmask\)0x0000000000000003"
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(i
    nt\)48000\,\ channels\=\(int\)2\,\ channel-mask\=\(bitmask\)0x0000000000000003"
    /GstPipeline:pipeline0/GstAlsaSink:alsasink0.GstPad:sink: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\
    )48000\,\ channels\=\(int\)2\,\ channel-mask\=\(bitmask\)0x0000000000000003"
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(
    int\)48000\,\ channels\=\(int\)2\,\ channel-mask\=\(bitmask\)0x0000000000000003"

    But unfortunately I dont get any audio either!

    Any pointers to debug this, I am using the ti81xx master branch from arago.

    Thanks And Regards,
    Mike
  • mike A said:
    root@dm814x-evm:~# arecord -D 'hw:0,0' -r 48000 -d 10 -f dat song.dat
    Recording WAVE 'song.dat' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    arecord: pcm_read:2031: read error: Input/output error

    Any pointers where to debug this ?

    This is working fine on the TI EVM with the latest linux kernel from the arago:

    root@dm814x-evm:~# arecord -D 'hw:0,0' -r 48000 -d 10 -f dat song.dat
    Recording WAVE 'song.dat' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    root@dm814x-evm:~# ls
    song.dat

    Check your HW connection and audio codec porting.

    mike A said:
    I also tried with gstreamer:

    I am not familiar with gstreamer.

    BR
    Pavel

  • Hi Pavel,

    I am trying this on the custom hardware,

    root@dm814x-evm:~# arecord -f dat song.wav -d 10
    Recording WAVE 'song.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    overrun!!! (at least 417.514 ms long)
    overrun!!! (at least 769.683 ms long)
    overrun!!! (at least 373.403 ms long)
    overrun!!! (at least 110.771 ms long)

    I get these overruns & create multiple files. With this error which part needs to debugged the codec or mcasp driver ?

    Thanks And Regards,
    --Mike
  • Mike,

    With every Frame Sync either data is to be written/read from, failing which under run/overrun error conditions are reported.

    If you have a I/O Peripheral that is not transmitting/receiving in a consistent manner, there are several steps you can make

    Step 1: Are the clocks to the peripheral correctly set up
    Step 2: Are the buffers properly being serviced in time. Some peripherals (such as McASP) have a limited time window in which you need to service the buffers before a transmit overrun, or underrun condition will cause the state machines to generate an error. You can then use this information to back track and determine why the buffers are not being serviced in time by the CPU or DMAs.

    The overrun can happen when an application does not take new captured samples in time from alsa-lib.
    There could be several reasons for overrun to happen but it is usually points to system latency issues connected to CPU utilization or latency caused by the storage device.
    Things to try:

    increase the buffer size (ALSA buffer and period size)
    try to cache the file to be played in memory
    try to use application which use threads for interacting with ALSA and with the filesystem

    See also the below e2e threads:

    e2e.ti.com/.../835092
    e2e.ti.com/.../204638
    e2e.ti.com/.../245225

    Regards,
    Pavel