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 streaming over I2S in Beagle bone Rev A3

Hi,

Can anyone pls guide me for the above query.

I want to stream an Audio Wave file data over MCASP0 I2S lines.

I have interfaced the Beagle bone's MCASP0 interface  to NUVOTON Sound card's I2S.

These are the four data lines from Beagle bone :

1. LCD_DATA8.MCASP0_ACLKX

2. LCD_DATA9.MCASP0_FSX

3. LCD_DATA12.MCASP0_AXR2

4. LCD_DATA13.MCASP0_AXR3

I have configured the NUVOTON Sound card chip with an SPI Control interface from another on-board  Microcontroller(LPC2368 (Non-OS)).

But I am giving the I2S interface of NUVOTON with AM335X MCASP interface(LInux OS) only.

I have made following changes for MCASP0 :

................................................................................

lucid@ubuntu:/usr/local/ti-sdk-am335x-evm/board-support/linux-3.1.0-psp04.06.00.03.sdk/sound/soc/davinci$ vi davinci-evm.c

static struct snd_soc_dai_link am335x_evm_dai = {
        .name = "TLV320AIC3X",
        .stream_name = "AIC3X",
        .cpu_dai_name = "davinci-mcasp.0",
        .codec_dai_name = "tlv320aic3x-hifi",
        .codec_name = "tlv320aic3x-codec.2-001b",
        .platform_name = "davinci-pcm-audio",
        .init = evm_aic3x_init,
        .ops = &evm_ops,
};
....................................................................................................................................................................................................................................................

/* Module pin mux for mcasp0 */
static struct pinmux_config mcasp0_pin_mux[] = {
        {"lcd_data8.mcasp0_aclkx", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLDOWN},
        {"lcd_data9.mcasp0_fsx", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLDOWN},
        {"lcd_data12.mcasp0_axr2", OMAP_MUX_MODE4 | AM33XX_PIN_INPUT_PULLDOWN},
        {"lcd_data13.mcasp0_axr3", OMAP_MUX_MODE4 | AM33XX_PIN_INPUT_PULLDOWN},
        {NULL, 0},
}; 

static u8 am335x_iis_serializer_direction0[] = {
        INACTIVE_MODE,  INACTIVE_MODE,  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,
};

 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,
};

 /* Setup McASP 0 */
static void mcasp0_init(int evm_id, int profile)
{
        /* Configure McASP */
        setup_pin_mux(mcasp0_pin_mux);
        am335x_register_mcasp0(&am335x_evm_snd_data0);
        return;
}

 /* Beaglebone Rev A3 and after */
static struct evm_dev_cfg beaglebone_dev_cfg[] = {
        {mii1_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
        {usb0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
       {usb1_init,     DEV_ON_BASEBOARD, PROFILE_NONE}, {mcasp0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
        {mmc0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
        {NULL, 0, 0},
};

.................................................................................................................................................................................................................................................................................

lucid@ubuntu:/usr/local/ti-sdk-am335x-evm/board-support/linux-3.1.0-psp04.06.00.03.sdk/arch/arm/mach-omap2$ vi devices.c

Devices.c

#if defined (CONFIG_SND_AM335X_SOC_EVM)
static struct resource am335x_mcasp0_resource[] = {
        {
                .name = "mcasp0",
                .start = AM33XX_ASP0_BASE,
                .end = AM33XX_ASP0_BASE + (SZ_1K * 12) - 1,
                .flags = IORESOURCE_MEM,
        },
        /* TX event */
        {
                .start = AM33XX_DMA_MCASP0_X,
                .end = AM33XX_DMA_MCASP0_X,
                .flags = IORESOURCE_DMA,
        },
        /* RX event */
        {
                .start = AM33XX_DMA_MCASP0_R,
                .end = AM33XX_DMA_MCASP0_R,
                .flags = IORESOURCE_DMA,
        },
};

static struct platform_device am335x_mcasp0_device = {
        .name = "davinci-mcasp",
        .id = 1,
        .num_resources = ARRAY_SIZE(am335x_mcasp0_resource),
        .resource = am335x_mcasp0_resource,
};

void __init am335x_register_mcasp0(struct snd_platform_data *pdata)
{
        am335x_mcasp0_device.dev.platform_data = pdata;
        platform_device_register(&am335x_mcasp0_device);
}

 .................................................................................................................................................................................................................................................................................

As I dont have the C0ntrol interface I have copied an Dummy driver in Davinci folder.Kernel recognizes the Dummy sound driver :

Below is flow :

I have played a wave file of 30 seconds using command 'aplay'

Audio streamed data is coming into the "dummy_pcm_trigger" function,i have called davinci_pcm_trigger()  function by passing *substream and and command.

As of now I have did these changes.

MCASP is configured as Slave and my external sound card chip is configured as Master. Bitclock and wordcolck is given to Beagle bone I2S interface.

When I am trying to play the Wave file using aplay i am not getting the Digital audio output.

Am I correctly streaming it or am I missing any thing ? Pls suggest me how shall I stream the audio data over I2S..