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.

Problem interfacing AIC3107 with OMAP L138 using MCBSP

Other Parts Discussed in Thread: OMAPL138, OMAP-L138

Hi,

We are trying to interface AIC3107 audio codec to OMAP L138 using MCBSP1.

Following is information on base kernel version I used:
PSP version : "DaVinci-PSP-SDK-03.21.00.04"
Kernel Version : 2.6.37

For our project we have interfaced audio codec with MCBSP1.

The kernel has AIC3X codec driver, mcasp and mcbsp drivers.
By default the kernel associates AIC3X codec with mcasp. It uses ALSA architecture.
Available MCBSP driver is not ALSA complaint and does not have "snd_soc_dai_ops" implemented.
These are the major changes that are to made to get it working for our system
I have not yet ported tlvaic3107 codec files in this kernel. I am expecting that with available aic3x codec driver I should be able to atleast capture and record some audio as the basic codec architecture is same.

For making mcbsp ALSA compiant i understand we need to initialize "davinci_pcm_dma_params" struct params for capture and playback in mcbsp driver. I have made modifications for this in mcbsp.c driver file. Also I have implemented "davinci_mcbsp_dai_ops" into mcbsp driver.
Attached are the driver files I have modified.

As a setup we have connected OMAPL138 board(MCBSP1) with AIC3107 audio codec evm.

We can see codec registration and mapping with mcbsp1. A sound card gets listed.
Following is a snap from kernel bootup log:
=====================================
asoc: tlv320aic3x-hifi <-> davinci-mcbsp.1 mapping ok
ALSA device list:
  #0: DA850/OMAP-L138 EVM
=====================================

Following are test results:
---------------------------
I used arecord and aplay applications to record and play audio files.

When I try to record an audio file, I dont see anything being recorded in the ouput audio file. However
using the ocilloscope I probed data(DOUT) and clock(WCLK, BCLK) lines on the AIC3107 evm and I can see activity on these lines.

When I try to play a file I can see activity on WCLK and BCLK lines but the DIN line stays low(no activity).

Seems something is wrong with mcbsp driver on OMAPL138, as it is not able to dump recorded data into a file. Neither it is able to read from and file and send it to AIC3107 evm.  

Appreciate help on this issue !!


Thanks,

Snehal

  • Hi,

    Instead of modifying the generic mcbsp driver you should be using davinci-i2s.c under sound/soc/davinci/. When this driver is used, you'll just need to setup up the ALSA machine driver based on your setup.

    Regards,

    Vaibhav

  • Hi Vaibhav,

     

    The i2s driver file has followwing comment

    "In short:  this uses ASP to implement I2S, not McBSP."

    Is it  valid ?

     

    Thanks,

    Snehal

     

  • Hi,

    Yes, both ASP and McBSP are same.

    Regards, Sudhakar

  • Hi Sudhakar, Vaibhav,

     

    I used davnci-i2s.c

    However when I try to record or play back. I see "Input/output error" msg. This is the same error message I saw when using the "modified generic mcbsp driver".

    To record audio I use "arecord -r 48000 -c 2 -f S16_LE -t raw -v -d 5  voice.raw". The recorded file size is 0.

    Ti play I use "aplay test.raw -r 22050 -c 2 -f S32_BE -t raw -v -d 1". Noting is seen on the data lines, as probed on CRO.

    Can you suggest what could be the problem ?

     

    Thanks,

    Snehal

  • Snehal Parmar said:
    The recorded file size is 0.

    Snehal Parmar said:
    Noting is seen on the data lines, as probed on CRO

    Are the BCLK and WCLK fine? BCLK should be ~1.5MHz in the first case and and ~1.4MHz in the second case.

    Who is acting as the master - the codec or the SoC? If the codec is acting as the slave have you made appropriate changes in davinci-evm.c?

    Are the DMA events registered? You can put a printk inside the EDMA interrupt handler present in davinci-pcm.c to check this.

    Regards,

    Vaibhav

  •  

    Following are error lines if it helps:

    arecord: pcm_read:1617: read error: Input/output error

    aplay: pcm_write:1528: write error: Input/output error

  •  

    We configured the AIC3107 codec as master.

    davinci-i2s.c driver file uses some dma parameters - "sram_size_playback" , " sram_size_capture", "asp_chan_q", "ram_chan_q".

    I set the following values:

    sram_size_playback           = 1 * 1024,
    sram_size_capture             = 1 * 1024,
    asp_chan_q                         = EVENTQ_1,
    ram_chan_q                         = EVENTQ_1,

    Do they look fine ?

     

  • BCLK is 1.5 MHZ , WCLK is ~47KHz with arecord 

    BCLK is 1.37 MHZ, WCLK is ~43KHz with aplay

    AIC3107 codec is master.

    To check DMA events registration I put prints in "davinci_pcm_open". 

    "davinci_pcm_open" returns successfully. "davinci_pcm_dma_request" returns successfully.

     

    davinci-i2s.c driver file uses some dma parameters - "sram_size_playback" , " sram_size_capture", "asp_chan_q", "ram_chan_q".

    I set the following values:

    sram_size_playback           = 1 * 1024,
    sram_size_capture             = 1 * 1024,
    asp_chan_q                         = EVENTQ_1,
    ram_chan_q                         = EVENTQ_1,

    Do they look fine ?

     

    Regards,

    Snehal

  • Hi, Snehal,

    I also use mcbsp1 with AIC3101 codec,  and get the errors as same as your's,  do you have a new progress?

    Regards

    Peng

  • Hi Peng,

    Figured that the default codec settings as in aic31x codec file do not work on AIC3107.

    I had an AIC3107 EVM.  Used the EVM to derive correct settings as per my board configuration. After applying the derived settings(from EVM testing) for the codec i could get it to work.

    Try to get the EVM to work as per your connections and then apply those settings on ur board, hopefully it will work for you.

     

    Thanks,

    Snehal

     

  • Are you still use sound/soc/davinci/davinci-i2s.c file for mcbsp driver ? do you have any change or configure ?

  •  Hi, Snehal,

    thanks, It works!!!

    Peng