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.

Audio by MCASP0 on custom am335x board

Hello all,

I need some help about audio on a custom am335x board. I have done some changes on kernel but I couldn't hear anything.

We used I2C0 and there is no problem on communication with codec.  In spite of communication, codec doesn't run properly. There is no bit clock and frame sync. clock on codec. 

I can see below debugs while linux booting;

[    0.098876] omap_mux_init: Add partition: #1: core, flags: 0

[    0.100189]  omap_i2c.1: alias fck already exists

[    0.100708]  omap2_mcspi.1: alias fck already exists

[    0.100799]  omap2_mcspi.2: alias fck already exists

[    0.100952]  edma.0: alias fck already exists

[    0.100982]  edma.0: alias fck already exists

[    0.100982]  edma.0: alias fck already exists

[    0.111541] musb-ti81xx musb-ti81xx: musb0, board_mode=0x13, plat_mode=0x3

[    0.111724] musb-ti81xx musb-ti81xx: musb1, board_mode=0x13, plat_mode=0x1

[    0.112152] omap_i2c omap_i2c.1: bus 1 rev2.4.0 at 100 kHz

[    0.133361] Advanced Linux Sound Architecture Driver Version 1.0.24. [    1.490631] asoc: tlv320aic3x-hifi <-> davinci-mcasp.0 mapping ok

[    1.497863] ALSA device list:

[    1.500946]   #0: AM335X EVM

And We used MCASP0 and i2c0 like below

 

board-am335xevm.c

 

static void i2c0_init(int evm_id, int profile)

{

        setup_pin_mux(i2c0_pin_mux);

        omap_register_i2c_bus(2, 100, am335x_i2c_boardinfo0,  ARRAY_SIZE(am335x_i2c_boardinfo0));

        return;

}

 

static struct pinmux_config i2c0_pin_mux[] = {

        {"i2c0_sda.i2c0_sda",    OMAP_MUX_MODE0 | AM33XX_SLEWCTRL_SLOW |

                                        AM33XX_PULL_ENBL | AM33XX_INPUT_EN},

        {"i2c0_scl.i2c0_scl",   OMAP_MUX_MODE0 | AM33XX_SLEWCTRL_SLOW |

                                        AM33XX_PULL_ENBL | AM33XX_INPUT_EN},

        {NULL, 0},

};

 

static struct i2c_board_info am335x_i2c_boardinfo0[] = {

        {

                I2C_BOARD_INFO("tlv320aic3x", 0x1b),

        },

};

 

/* Setup McASP 0 */

static void mcasp0_init(int evm_id, int profile)

{

        /* Configure McASP */

        setup_pin_mux(mcasp0_pin_mux);

        am335x_register_mcasp(&am335x_evm_snd_data0, 0);

        return;

}

 

/* Module pin mux for mcasp0*/

static struct pinmux_config mcasp0_pin_mux[] = {

        {"mcasp0_aclkx.mcasp0_aclkx", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},

        {"mcasp0_fsx.mcasp0_fsx", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},

        {"mcasp0_axr0.mcasp0_axr0", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},

        {"mcasp0_axr1.mcasp0_axr1", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},

        {NULL, 0},

};

 

static struct snd_platform_data am335x_evm_snd_data0 = {

        .tx_dma_offset   = 0x46000000,   /* McASP0 */

        .rx_dma_offset   = 0x46000000,

        .op_mode  = DAVINCI_MCASP_IIS_MODE,

        .num_serializer  = ARRAY_SIZE(am335x_iis_serializer_direction0),

        .tdm_slots  = 2,

        .serial_dir  = am335x_iis_serializer_direction0,

        .asp_chan_q       = EVENTQ_2,

        .version     = MCASP_VERSION_3,

        .txnumevt  = 1,

        .rxnumevt  = 1,

};

 

static u8 am335x_iis_serializer_direction0[] = {

        TX_MODE,      INACTIVE_MODE,  RX_MODE,      INACTIVE_MODE,

        INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,

        INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,

        INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,

};

 

static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {

        {enable_ecap0,   DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_1 |

                                                PROFILE_2 | PROFILE_7) },

        {lcdc_init, DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_1 |

                                                PROFILE_2 | PROFILE_7) },

        {tsc_init,   DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_1 |

                                                PROFILE_2 | PROFILE_7) },

     {mii1_init,        DEV_ON_BASEBOARD, PROFILE_ALL},// add by colin 20130709

        {usb0_init,        DEV_ON_BASEBOARD, PROFILE_ALL},

        {usb1_init,        DEV_ON_BASEBOARD, PROFILE_ALL},

        {evm_nand_init, DEV_ON_BASEBOARD, (PROFILE_ALL & ~PROFILE_2 & ~PROFILE_3)},

     {i2c0_init,     DEV_ON_BASEBOARD, (PROFILE_ALL & ~PROFILE_2)},
     {mcasp0_init,    DEV_ON_BASEBOARD, (PROFILE_NONE)},

     {mmc0_init,     DEV_ON_BASEBOARD, (PROFILE_ALL & ~PROFILE_5)},

        {mmc0_no_cd_init,    DEV_ON_BASEBOARD, PROFILE_5},

        {spi0_init, DEV_ON_BASEBOARD, PROFILE_2},        

{uart4_init,      DEV_ON_BASEBOARD, PROFILE_ALL},

        {NULL, 0, 0},

};

 

davinci-evm.c

 

static struct snd_soc_dai_link am335x_evm_dai = {

        .name = "TLV320AIC3X",

        .stream_name = "AIC3X",

        .cpu_dai_name = "davinci-mcasp.0",//1->0 revised colin 20130716

        .codec_dai_name = "tlv320aic3x-hifi",

        .codec_name = "tlv320aic3x-codec.2-001b",

        .platform_name = "davinci-pcm-audio",

        .init = evm_aic3x_init,

        .ops = &evm_ops,

};

  • Hi,

    The settings seems good. I believe your connections and modes are similar to am335xevm except you are using mcasp0 and i2c0.

    Isn't the serializer_direction be like this?


    static u8 am335x_iis_serializer_direction0[] = {
            TX_MODE,        RX_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
            INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
            INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
            INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
    };

    Have you changed anything in the driver code?

    What is the playback error you are getting?

    Regards,

    Arun

  • I did not change anything in driver

    Our custom board is referred to the am335xevm board except we are using mcasp0 and i2c0.

    There is no cpld in our custom board.

    the playback error is below:

    D/Eas Debug(  436): Logging:

    I/ActivityManager(  135): Process com.android.deskclock (pid 474) has died.                                                                            s

    W/ThrottleService(  135): unable to find stats for iface rmnet0

    E/audio_hw_primary(   74): Route MIXER CTRL name: PCM Playback Volume

    D/PhoneStatusBar(  210): disable: < expand icons alerts ticker system_info BACK HOME recent* CLOCK >

    D/PhoneStatusBar(  210): disable: < expand icons alerts ticker system_info back* home* recent clock* >

    I/ActivityManager(  135): Displayed com.android.launcher/com.android.launcher2.Launcher: +1m54s804ms

    I/ActivityManager(  135): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.gallery3d/.app.Gallery bnds=[307,141][413,215]} from pid 272

    D/PermissionCache(  126): checking android.permission.READ_FRAME_BUFFER for uid=1000 => granted (1342 us)

    I/ActivityManager(  135): Start proc com.android.gallery3d for activity com.android.gallery3d/.app.Gallery: pid=581 uid=10044 gids={3003, 1015, 1023}

    W/NetworkManagementSocketTagger(  135): setKernelCountSet(10044, 1) failed with errno -2

    I/ActivityThread(  581): Pub com.android.gallery3d.provider: com.android.gallery3d.provider.GalleryProvider

    I/ActivityManager(  135): Process com.android.exchange (pid 436) has died.

    V/StateManager(  581): startState class com.android.gallery3d.app.AlbumSetPage

    D/dalvikvm(  135): GC_EXPLICIT freed 395K, 11% free 8414K/9351K, paused 4ms+6ms

    D/dalvikvm(  581): GC_CONCURRENT freed 207K, 5% free 6699K/6983K, paused 5ms+2ms

    V/GalleryActionBar(  581): showClusterMenu: runner=com.android.gallery3d.app.AlbumSetPage@410cd4b0

    V/MtpDeviceSet(  581): loadDevices: [], size=0

    D/Gallery.MultiSetSync(  581): onSyncDone: MTP devices #pending=2

    D/Gallery.MultiSetSync(  581):   request sync: MTP devices

    D/Gallery.MultiSetSync(  581): onSyncDone: Local albums #pending=1

    D/Gallery.MultiSetSync(  581):   request sync: Local albums

    D/Gallery.MultiSetSync(  581): onSyncDone: picasa #pending=0

    D/Gallery.MultiSetSync(  581):   request sync: picasa

    V/MtpDeviceSet(  581): loadDevices: [], size=0

    D/libEGL  (  581): loaded /system/lib/egl/libGLES_android.so

    D/libEGL  (  581): loaded /system/lib/egl/libEGL_POWERVR_SGX530_125.so

    I/ActivityManager(  135): Displayed com.android.gallery3d/.app.Gallery: +1s439ms

    D/libEGL  (  581): loaded /system/lib/egl/libGLESv1_CM_POWERVR_SGX530_125.so

    D/libEGL  (  581): loaded /system/lib/egl/libGLESv2_POWERVR_SGX530_125.so

    I/ActivityManager(  135): Process com.android.calendar (pid 529) has died.

    W/NetworkManagementSocketTagger(  135): setKernelCountSet(10035, 0) failed with errno -2

    eryEGLConfigChooser(  581): Config chosen: R5 G6 B5 A0 D24 S8 ID7 CAVEAT12344

    I/ActivityManager(  135): Process com.android.providers.calendar (pid 491) has died.

    I/GLRootView(  581): onSurfaceChanged: 480x272, gl10: com.google.android.gles_jni.GLImpl@410e1a50

    I/GLRootView(  581): layout content pane 480x272

    D/dalvikvm(  272): GC_CONCURRENT freed 265K, 5% free 7737K/8135K, paused 37ms+13ms

    I/ActivityManager(  135): Process com.android.email (pid 549) has died.

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    V/StateManager(  581): startStateForResult class com.android.gallery3d.app.AlbumPage, 1

    D/AlbumPage(  581): onSyncDone: Video result=0

    I/GLRootView(  581): layout content pane 480x272

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    V/StateManager(  581): startStateForResult class com.android.gallery3d.app.PhotoPage, 2

    I/GLRootView(  581): layout content pane 480x272

    D/dalvikvm(  581): GC_FOR_ALLOC freed 63K, 6% free 7173K/7623K, paused 26ms

    I/dalvikvm-heap(  581): Grow heap (frag case) to 7.465MB for 405520-byte allocation

    I/dalvikvm-heap(  581): Grow heap (frag case) to 7.727MB for 522256-byte allocation

    D/dalvikvm(  581): GC_FOR_ALLOC freed <1K, 9% free 7836K/8583K, paused 28ms

    I/GLRootView(  581): layout content pane 480x272

    I/dalvikvm-heap(  581): Grow heap (frag case) to 8.317MB for 281896-byte allocation

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    I/AudioService(  135):  AudioFocus  requestAudioFocus() from android.media.AudioManager@413e7150

    I/ActivityManager(  135): Displayed com.android.gallery3d/.app.MovieActivity: +806ms

    I/OMXCodec(   74): [OMX.google.h263.decoder] video dimensions are 352 x 288

    I/OMXCodec(   74): [OMX.google.h263.decoder] Crop rect is 352 x 288 @ (0, 0)

    D/MediaPlayer(  581): getMetadata

    V/StateManager(  581): saveState

    V/StateManager(  581): saveState class com.android.gallery3d.app.AlbumSetPage

    V/StateManager(  581): saveState class com.android.gallery3d.app.AlbumPage

    V/StateManager(  581): saveState class com.android.gallery3d.app.PhotoPage

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

    W/AudioTrack(   74): obtainBuffer timed out (is the CPU pegged?) 0x1d8f8 user=00001e00, server=00000000

    W/AudioTrack(  135): obtainBuffer timed out (is the CPU pegged?) 0x272d18 user=00001e00, server=00000000

     

     

     

  • Are you able to playback audio files (.wav format) from the command-line. This will verify that your driver changes are ok.

    http://processors.wiki.ti.com/index.php/TI-Android-JB-4.2.2-DevKit-4.1.1_PortingGuide#Testing_audio_from_command_line

  • I use tinyplay to playback audio files such as the following:

    so I change the /device/ti/am335xevm/BoardConfig.mk

    add two lines.

    BOARD_USES_ALSA_AUDIO := true

    BUILD_WITH_ALSA_UTLS :=true

    and I use tinyplay to playback audio files such as following:

  • Did you probe your bit clock and word clock and see if they are proper when you start playback?

    Are your dapm routings similar to the EVM?

  • this problem is solved.

    thz u.

  • Can you tell what was the issue and how was it resolved?

  • Because the i2c0 of the bus is 1, I set the bus 2.

     

  • Hi!

    when i debug the tlvaic3104,i also have anther question by these steps ,for example testfile.wav: applet not found ,please tell me why this file not found?thank you .

  • Hi
    I dont't have tinyplay tools on linux, do you have anther methods to test the sucess of tlv3104?