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.

am3359 mcasp0 not work

Other Parts Discussed in Thread: AM3359

hello,

I try to run the mcasp0 on my custom am3359 board with a the max9860 codec, according to the debug message the mcasp0 seems to be well initialized (see above), but when i try to play sound with aplay, the "aplay" command there is no signal on the mcasp0 pins and the aplay command not exit, to do it, i must use ctrl+c key.

i try to change instance number of the mcasp0 to 1 (see above)  in the function but no change.

static struct snd_soc_dai_link am335x_evm_sk_dai = {

       .cpu_dai_name = "davinci-mcasp.0",  //replace by 1

};

/* Setup McASP 0 */

static void mcasp0_init(int evm_id, int profile)

{

       am335x_register_mcasp(&am335x_P0519_snd_data0, 0); //replace by 1

 

my config is that :

static u8 am335x_P0519_iis_serializer_direction1[] = {

TX_MODE, RX_MODE, INACTIVE_MODE, INACTIVE_MODE, //AXR0 en transmission et AXR1 en reception et les autres inactifs

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_P0519_snd_data0 = {

        .tx_dma_offset  = 0x46000000,   /* McASP0 */

        .rx_dma_offset  = 0x46000000,

        .op_mode        = DAVINCI_MCASP_IIS_MODE,

        .num_serializer = ARRAY_SIZE(am335x_P0519_iis_serializer_direction1),

        .tdm_slots      = 2, //mode I2S = 2 slots left and right

        .serial_dir     = am335x_P0519_iis_serializer_direction1,

        .asp_chan_q     = EVENTQ_2,

        .version        = MCASP_VERSION_3,

        .txnumevt       = 32,//taille de la FIFO pour les events

        .rxnumevt       = 32,//taille de la FIFO pour les events

             .get_context_loss_count    =

                    omap_pm_get_dev_context_loss_count,

};

 

static struct snd_soc_dai_link am335x_evm_sk_dai = {

       .name = "MAX9860",

       .stream_name = "Playback",

       .cpu_dai_name = "davinci-mcasp.0",

       .codec_dai_name = "max9860-hifi",

       .codec_name = "max9860-codec.1-0010",

       .platform_name = "davinci-pcm-audio",

       .ops = &evm_ops,

};

 

/* Setup McASP 0 */

static void mcasp0_init(int evm_id, int profile)

{

       /* Configure McASP */

       setup_pin_mux(mcasp0_pin_mux);

       am335x_register_mcasp(&am335x_P0519_snd_data0, 0);

       return;

}

 

/* Module pin mux for mcasp0 pour la gestion de l'audio*/

static struct pinmux_config mcasp0_pin_mux[] = {

       {"mcasp0_aclkx.mcasp0_aclkx", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, //BCLK en sortie

       {"mcasp0_fsx.mcasp0_fsx", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, //FRAME sync en sortie

       {"mcasp0_axr1.mcasp0_axr1", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN}, //AXR1 en entrée série synchrone

       {"mcasp0_axr0.mcasp0_axr0", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, //AXR0 en sortie série synchrone

      

       {"mcasp0_ahclkr.mcasp0_ahclkr", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, //non utilisé sortie horloge serie réception

       {"mcasp0_aclkr.mcasp0_aclkr", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, //non utilisé sortie horloge serie réception

       {"mcasp0_fsr.mcasp0_fsr", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, //non utilisé FRAME sync réception en sortie

       {"mcasp0_ahclkx.mcasp0_ahclkx", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, //non utilisé BCLK en sortie

       {NULL, 0},

};

debug message :

Registered platform 'snd-soc-dummy'                                                       

[    5.989959] init max9860                                                                              

[    5.992675] max9860-codec 1-0010: codec register 1-0010  

[    5.992706] max9860-codec 1-0010: dai register 1-0010 #1 

[    5.992706] Registered DAI 'max9860-hifi'                                                             

[    5.992706] Registered codec 'max9860-codec.1-0010'                                                                           

[    6.008209] davinci-pcm-audio davinci-pcm-audio: platform register davinci-pcm-audio                  

[    6.008239] Registered platform 'davinci-pcm-audio'                                                   

[    6.008544] davinci-mcasp davinci-mcasp.0: dai register davinci-mcasp.0                               

[    6.008575] Registered DAI 'davinci-mcasp.0'                                                           

[    6.009094] soc-audio soc-audio.0: binding MAX9860 at idx 0                                           

 [    6.009185] soc-audio soc-audio.0: probe AM335X EVM dai link 0 late -2                                

[    6.009216] soc-audio soc-audio.0: probe AM335X EVM dai link 0 late -1                                

[    6.009216] soc-audio soc-audio.0: probe AM335X EVM dai link 0 late 0                                 

[    6.009246] max9860 probe codec                                                                                                                                     

[    6.018402] soc-audio soc-audio.0: probe AM335X EVM dai link 0 late 1                                 

[    6.018432] soc-audio soc-audio.0: probe AM335X EVM dai link 0 late 2                                 

[    6.018493] max9860-codec 1-0010: read 2 => 0                                                          

[    6.018524] max9860-codec 1-0010: read 10 => 0                                                        

[    6.018524] max9860-codec 1-0010: read 10 => 0                                                         

[    6.018554] max9860-codec 1-0010: read 10 => 0                                                        

[    6.018554] max9860-codec 1-0010: read 10 => 0                                                        

[    6.018676] max9860-codec 1-0010: read 10 => 0                                                        

[    6.018676] max9860-codec 1-0010: write 10 = 80                                                       

[    6.019104] max9860-codec 1-0010: read 10 => 80                                                       

[    6.019104] max9860-codec 1-0010: write 10 = 88                                                       

[    6.019439] max9860-codec 1-0010: read 2 => 0                                                          

[    6.019470] max9860-codec 1-0010: write 2 = 4                                                         

[    6.019805] max9860-codec 1-0010: read 10 => 88                                                       

[    6.019805] max9860-codec 1-0010: write 10 = 8b                                                       

[    6.020843] asoc: max9860-hifi <-> davinci-mcasp.0 mapping ok                                         

[    6.028289] soc-audio soc-audio.0: Registered card 'AM335X EVM'                                       

[    6.028320] ALSA device list:                                                                         

[    6.031433]   #0: AM335X EVM       

My codec is well registered :

root@am335x-evm:/usr/share/sounds/alsa# aplay -l                                                          

**** List of PLAYBACK Hardware Devices ****                                                              

card 0: EVM [AM335X EVM], device 0: Playback max9860-hifi-0 []                                           

  Subdevices: 1/1                                                                                        

  Subdevice #0: subdevice #0   

  • I do not have a data sheet right now, but is 0x46000000 the correct DMA address?

  • You don't seem to be setting up your clocks--for instance, you don't specify in your snd_soc_dai_link 
    structure the dai_fmt value that tells the McASP if it is to be clock master/slave, what the clock polarity is, and so forth.  For an example, have a look at the Sitara Audio DAC Example page.  It is for SDK 7.0 which uses 3.12 (whereas you appear to be using 3.2 from SDK 6.0), but the concepts for everything except Device Tree will apply to your kernel.

    Furthermore, it looks like you are specifying McASP0 correctly in your board file; however, I would recommend that you check this e2e forum post,  where working patches are posted that set up McASP0 for 3.2 kernel.

  • My mcasp was configured as slave, i change the define AUDIO_FORMAT in the file /sound/soc/davinci-evm.c  i replaced SND_SOC_DAIFMT_CBM_CFM (master config) by SND_SOC_CBS_CFS (slave) , this make the codec in slave and the mcasp in master mode, now i can see the output signal on the mcasp0 pins.

    Thank you very much.