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.

Linux/PROCESSOR-SDK-AM335X: McASP Master mode configuration

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: TLV320AIC3106

Tool/software: Linux

Hi All,

I am using PSDK (3.02) and using Beaglebone Black to connect a codec SAF775x. I am writing a codec driver for this codec. I need to configure McASP0  so that it is able to generate BCLK and LRCLK with sampling rate 44.1KHz

For MCASP0 I am using  the following connection from the expansion header P9 of Beaglebone for configuring mcasp0. I have disabled HDMI audio and added mcasp0 in device tree. I am only using AXR0 as i am only configuring a playback channel.

A13 SPI1_SCLK P9.31 MCASP0_ACLKX Bit Clock
B13 SPI1_D0 P9.29 MCASP0_FSX Word Clock
D12 SPI1_D1 P9.30 MCASP0_AXR0 Tx

Device tree addition:

&mcasp0 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&mcasp0_pins>;
status = "okay";
op-mode = <0>; /* MCASP_IIS_MODE */
tdm-slots = <2>;
serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
1 0 0 0
>;
tx-num-evt = <32>;
rx-num-evt = <32>;
};

mcasp0_pins: mcasp0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /*mcasp0_aclkx.mcasp0_aclkx */
AM33XX_IOPAD(0x994, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0.mcasp0_fsx */
AM33XX_IOPAD(0x998, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0.mcasp0_axr0 */
>;
};

/ {

sound {
compatible = "simple-audio-card";
simple-audio-card,name = "TI BeagleBone Black";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&sound_master>;
simple-audio-card,frame-master = <&sound_master>;

sound_master:simple-audio-card,cpu {
sound-dai = <&mcasp0>;
system-clock-frequency = <24000000>;
};

simple-audio-card,codec {
sound-dai = <&saf775x>;
};
};
};

 My pcm device is detected. I have done basic implementation of codec driver and registered it as a sound card. But my MCASP0 clock is not being generated. I have not done any changes in mcasp driver. 

Please Suggest me the configuation or any changes required in mcasp

Thanks

Deep

  • Hi,

    You cannot generate a 44.1kHz bit clock from the 24MHz clock source available on AM335x. You will need an external clock source to do this.
  • Hi Biser,

    Thanks for reply. Can you please verify pin muxing. I will discuss and revert you regarding the clock source.

    Thanks
    Deep
  • One more concern Biser, How can the clock be generated externally
  • Regarding pinmuxing, I have asked the software team to comment.

    Regarding the clock source, an external clock generator is necessary to provide a master clock that can be divided down by the McASP to the 44.1kHz bit clock you require. The issue here is that the internal master clock is fixed to 24MHz (main oscillator clock), and the McASP divider is not fractional. 24MHz / 44.1kHz = 544.217 If you use a divider value of 544 you will get 24MHz /544 = 44.117kHz. You can check, this may be close enough for your requirements.
  • Hi Biser...
    LRCLK is 44.1 KHz not the bit clock.
  • So what bit clock do you need?
  • As Bit Clk= SampleRate * Channels * BitsPerSample

    for 44.1 kHz, 16-bits stereo audio, the min BCLK is 1.4112 MHz. So this Bit clock is our requirement
  • OK, this is a divide by 17 from 24MHz, so you won't need an external clock.
  • Thanks Biser,

    Can you please let me know what software changes are required to generate this clock..what changes are required in device tree and mcasp driver.
    Thanks
    Deep
  • I already told you that the software team have been notified. They will respond here when they can.
  • Thanks a lot Biser !

    Deep
  • Deep,

    Regarding BCLK/ACLKX, what frequency you need there? 44.1KHz is supported by default in McASP driver:

    processors.wiki.ti.com/.../AM335x_Audio_Driver's_Guide

    Multiple sample rates support (8KHz, 16KHz, 22.05KHz, 32KHz, 44.1KHz, 48KHz, 64KHz, 88.2KHz and 96KHz) for both capture and playback.

    Regarding LRCLK clock, on which McASP pin exactly you connect this codec pin? Please provide more info regarding codec LRCLK signal.

    Regards,
    Pavel
  • See also the below e2e thread:

    e2e.ti.com/.../580803

    Regards,
    Pavel
  • We also had a customer stating the Dirana3 SAF7751EL codec does not need linux driver:

    e2e.ti.com/.../1663912

    DiRANA3 doesn't require driver to initialize from J5-Eco .It has firmware in it which gets initialized over I2C when powered on.
  • Hi,

    Thanks Pavel for reply. I have also written a dummy driver just to get a pcm device playback.

    . Right now I have connected only 1 mcasp0 to Dirana3  to check  the playback. I can communicate to D3 using I2C and have initialized it to recieve  i/p bit and word clock.

    But my MCASP0 is not generating clock.  I will check the MCASP0 registers and let you know.

    Also please verify if I am using the correct McASP0 pins that I am connecting to BBB.

    Thanks a lot Pavel!!

    You always help me.

    Deep

  • Hi Pavel,

    I have pinmuxed the pins from expansion header P9 from Beaglebone Black Rev C to make it work as MCASP0.
    A13 SPI1_SCLK P9.31 MCASP0_ACLKX Bit Clock
    B13 SPI1_D0 P9.29 MCASP0_FSX Word Clock
    D12 SPI1_D1 P9.30 MCASP0_AXR0 Transmit (Playback)

    I need BCLK=1.411MHz and LRCK=44.1KHz.

    If you need anymore information please let me know
  • I am getting the following output during aplay

    root@am335x-evm:/bin# aplay audiocheck1_10th_copy_converted.wav &

    [1] 1209

    root@am335x-evm:/bin# [ 1519.033156] ***Inside the function *davinci_mcasp_startup****

    Playing WAVE 'audiocheck1_10th_copy_converted.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

    [ 1519.054529] *******Inside saf775x_hw_params********

    [ 1519.059490] ****The value of fmt & SND_SOC_DAIFMT_FORMAT_MASK is **********0x1

    [ 1519.072231] ***The value of DAVINCI_MCASP_TXFMT_REG is 0x18074

    [ 1519.078137] ***The value of fmt & SND_SOC_DAIFMT_MASTER_MASK is 0x4000

    [ 1519.095634] ************The value of DAVINCI_MCASP_ACLKXCTL_REG inside mcasp_dai_fmt is 0x1800b0

    [ 1519.104705] ******The value of DAVINCI_MCASP_ACLKRCTL_REG inside mcasp_dai_fmt is 0x1800b0

    [ 1519.118140] ******The value of DAVINCI_MCASP_TXFMCTL_REG inside mcasp_dai_fmt is 0x113

    [ 1519.133448] ***the value of slots =2 rate =44100 sbits=16

    [ 1519.138943] davinci-mcasp 48038000.mcasp: Sample-rate is off by 400 PPM

    [ 1519.152532] *******Inside saf775x_prepare********

    [ 1519.163911] Register  0x48038010  value PFUNC_REG 0

    [ 1519.168862] Register  0x48038014 value PDIR Register  b4000001

    [ 1519.174731] Register 0x48038018  value PDOUT Register  0

    [ 1519.180074] Register 0x4803801c value PDIN Register  0

    [ 1519.185242] Register 0x48038020 value PDCLR Register  0

    [ 1519.190498] Register 0x48038044 value GBLCTL Register  200

    [ 1519.196014] Register 0x48038048 value AMUTE Register  0

    Am I missing something in the device tree? Also I checked the link  

    Should I used AHCLKX instead of ACLKX?

     

    Thanks

    Deep

  • deep ter said:
    I have pinmuxed the pins from expansion header P9 from Beaglebone Black Rev C to make it work as MCASP0.
    A13 SPI1_SCLK P9.31 MCASP0_ACLKX Bit Clock
    B13 SPI1_D0 P9.29 MCASP0_FSX Word Clock
    D12 SPI1_D1 P9.30 MCASP0_AXR0 Transmit (Playback)

    I need BCLK=1.411MHz and LRCK=44.1KHz.

    If you need anymore information please let me know

    How exactly you verify your pinmux is correct?

    I would suggest you to check the corresponding registers value in user space with devmem2 tool (or omapconf):

    conf_mcasp0_aclkx at addr 0x44E10990

    conf_mcasp0_fsx at addr 0x44E10994

    conf_mcasp0_axr0 at addr 0x44E10998

    Provide me these values for review.

  • deep ter said:
    I need BCLK=1.411MHz and LRCK=44.1KHz.

    BCLK is supplied by mcasp0_aclkx pin correct? So you need to output 1.411MHz (1411KHz) on this pin? Which is the clock source of your mcasp0_aclkx pin (AUX_CLK or AHCLKX)? See AM335x TRM, section 22.3.5.1 Transmit Clock

    If you are not sure regarding the source, provide me the values of the below McASPo registers:

    AHCLKXCTL
    ACLKXCTL

    deep ter said:
    LRCK=44.1KHz

    Do you connect Dirana3 codec LRCK pin to mcasp0_fsx pin? Please provide more info regarding LRCK signal.

    Regards,
    Pavel

  • HI Pavel,

    I have verified the pinmux.

    root@am335x-evm:~# devmem2 0x44E10990
    Read at address : 0x00000000

    root@am335x-evm:~# devmem2 0x44E10994
    Read at address : 0x00000000

    root@am335x-evm:~# devmem2 0x44E10998
    Read at address : 0x00000000

    As all the address are in MODE 0 . It has been verified that pin mux is proper.

    Thanks
    Deep
  • deep ter said:
    root@am335x-evm:~# devmem2 0x44E10990
    Read at address : 0x00000000

    root@am335x-evm:~# devmem2 0x44E10994
    Read at address : 0x00000000

    root@am335x-evm:~# devmem2 0x44E10998
    Read at address : 0x00000000

    These log looks suspiciously wrong. I expect to see the below format:

    root@am335x-evm:~# devmem2 <phy_addr>
    /dev/mem opened.
    Memory mapped at address <virt_addr>.
    Read at address  <phy_addr> (<virt_addr>): <value>


    See the below e2e post for more examples:

    deep ter said:
    As all the address are in MODE 0

    The address can not be in MODE 0, the value in that address can be in MODE 0

  • Hi Pavel,

    these are the logs:

    root@am335x-evm:~# devmem2 0x44E10990
    /dev/mem opened.
    Memory mapped at address 0xb6f89000.
    Read at address 0x44E10990 (0xb6f89990): 0x00000000
    root@am335x-evm:~# devmem2 0x44E10994
    /dev/mem opened.
    Memory mapped at address 0xb6f9b000.
    Read at address 0x44E10994 (0xb6f9b994): 0x00000000
    root@am335x-evm:~# devmem2 0x44E10998
    /dev/mem opened.
    Memory mapped at address 0xb6fc7000.
    Read at address 0x44E10998 (0xb6fc7998): 0x00000000

    Yes Pavel,

    BCLK is supplied by mcasp0_aclkx pin. Also mcasp0_fsx is connected to LRCK pin of DiRANA3 .
    I need to output 1.411MHz (1411KHz) on this pin as I am using a stereo channel with 44.1KHz sampling frequency.

    I have mentioned the following in the device tree
    sound {
    compatible = "simple-audio-card";
    simple-audio-card,name = "TI BeagleBone Black";
    simple-audio-card,format = "i2s";
    simple-audio-card,bitclock-master = <&sound_master>;
    simple-audio-card,frame-master = <&sound_master>;

    sound_master:simple-audio-card,cpu {
    sound-dai = <&mcasp0>;
    system-clock-frequency = <24000000>;
    };

    simple-audio-card,codec {
    sound-dai = <&saf775x>;
    };
    };
    };

    This means I am giving AUX_CLK as source of aclkx_pin. Please correct me if i am wrong.
    I checked the device parameters added in the link e2e.ti.com/.../456475.

    .tx_dma_offset = 0x46800000,
    .rx_dma_offset = 0x46800000,
    .op_mode = DAVINCI_MCASP_IIS_MODE,
    .num_serializer = ARRAY_SIZE(ti811x_iis_serializer_direction_mcasp2),---------------------------------------MCASP2
    .tdm_slots = 2,
    .serial_dir = ti811x_iis_serializer_direction_mcasp2,
    .asp_chan_q = EVENTQ_2,
    .version = MCASP_VERSION_2,
    .txnumevt = 1,
    .rxnumevt = 1,
    /* McASP2_AHCLKX out to feed CODEC CLK*/
    .clk_input_pin = MCASP_AHCLKX_IN,
    }

    But in am335x-beaglebone.dts I was unable to find how to put MCASP_AHCLKX_IN as i/p.

    I will share you the values of AHCLKXCTL and ACLKXCTL in some time

    Thanks
    Deep
  • deep ter said:
    root@am335x-evm:~# devmem2 0x44E10990
    /dev/mem opened.
    Memory mapped at address 0xb6f89000.
    Read at address 0x44E10990 (0xb6f89990): 0x00000000
    root@am335x-evm:~# devmem2 0x44E10994
    /dev/mem opened.
    Memory mapped at address 0xb6f9b000.
    Read at address 0x44E10994 (0xb6f9b994): 0x00000000
    root@am335x-evm:~# devmem2 0x44E10998
    /dev/mem opened.
    Memory mapped at address 0xb6fc7000.
    Read at address 0x44E10998 (0xb6fc7998): 0x00000000

    Yes, mode 0 is selected on these pins (A13.mcasp0_aclkx, B13.mcasp0_fsx and D12.mcasp0_axr0). But you have bit [5] rx_active also 0 (receive disable), while we have requirement to configure mcasp0_aclkx and mcasp0_fsx signals for I/O ([5] rx_active = 1). See AM335x TRM, section 22.2.3 McASP Pin List. Please change the value in addr 0x44E10990/0x44E10994 at 0x00000020


    deep ter said:
    BCLK is supplied by mcasp0_aclkx pin

    deep ter said:
    I need to output 1.411MHz (1411KHz) on this pin

    deep ter said:
    This means I am giving AUX_CLK as source of aclkx_pin

    Do you have any clock output on mcasp0_aclkx pin?

    mcasp0_aclkx frequency depends on:

    1. MCASP0_FCLK (aux_clk) frequency - please provide me what is the frequency of aux_clk

    2. McASP0 registers PFUNC, PDIR, ACLKXCTL and AHCLKXCTL - please provide me what values you have in these registers

    Regards,
    Pavel

  • Hi Pavel,

    These are my register dump while playing  aplay

    root@am335x-evm:/bin# [   36.891944] ***Inside the function *davinci_mcasp_startup****

    Playing WAVE 'audiocheck1_10th_copy_converted.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

    [   36.918412] *******Inside saf775x_hw_params********

    [   36.923544]  MCASP0.XFMT/0x480380a8 = 0x10000

    [   36.927934] Inside codec is clock and frame slave

    [   36.938918] SND_SOC_DAIFMT_NB_NF

    [   36.946668] MCASP->BCLK_DIV 0

    [   36.949699] ***the value of slots =2 rate =44100 sbits=16

    [   36.963393] davinci-mcasp 48038000.mcasp: Sample-rate is off by 400 PPM

    [   36.970082] Inside __davinci_mcasp_set_clkdiv

    [   36.987803] div_id=1 div = 17 explicit= 0

    [   36.995256] *******Inside saf775x_prepare********

    [   37.013157] In mcasp_start_tx function

    [   37.016984] Register  0x48038010  value PFUNC_REG 0

    [   37.021896] Register  0x48038014 value PDIR Register  b4000001

    [   37.027761] Register 0x48038018  value PDOUT Register  0

    [   37.033104] Register 0x4803801c value PDIN Register  0

    [   37.038271] Register 0x48038020 value PDCLR Register  0

    [   37.043525] Register 0x48038044 value GBLCTL Register  200

    [   37.049041] Register 0x48038048 value AMUTE Register  0

    [   37.054295] Register 0x480380B0  value ACLKXCTL Register  1800b0

    [   37.060335] Register 0x480380B4  value AHCLKXCTL Register  0

    root@am335x-evm:/bin# aplay: pcm_write:1940: write error: Input/output error

    It seems that the clock which has been provided is not proper.

    That is why we are getting 

     davinci-mcasp 48038000.mcasp: Sample-rate is off by 400 PPM

     


    Thanks

    Deep

     

  • Hi Pavel,

    I was not able to get the aux clock value. 

    I was going through the BBB schematic and I found this:

    So  I need to configure GPIO3_21 as a clock  and this clock would be input to  MCASP0_AHCLKX as shown in the schematics:

    One more doubt       "But you have bit [5] rx_active also 0 (receive disable), while we have requirement to configure mcasp0_aclkx and mcasp0_fsx signals for I/O ([5] rx_active = 1). See AM335x TRM, section 22.2.3 McASP Pin List. Please change the value in addr 0x44E10990/0x44E10994 at 0x00000020" 

    Why do we need to set 0x00000020 value as we are only using it as a Transmit? Please explain

    Thanks

    Deep

  • deep ter said:
    [   36.963393] davinci-mcasp 48038000.mcasp: Sample-rate is off by 400 PPM

    See if the below e2e thread will be in help:

    deep ter said:
    [   37.016984] Register  0x48038010  value PFUNC_REG 0

    PFUNC looks correct

    deep ter said:
    [   37.021896] Register  0x48038014 value PDIR Register  b4000001

    PDIR looks correct

    deep ter said:
    [   37.054295] Register 0x480380B0  value ACLKXCTL Register  1800b0

    ACLKXCTL[5] CLKXM = 1 looks correct

    deep ter said:
    [   37.060335] Register 0x480380B4  value AHCLKXCTL Register  0

    AHCLKXCTL[15] HCLKXM = 0 does NOT look correct.

    In linux kernel this is DAVINCI_MCASP_AHCLKXCTL_REG[15] AHCLKXE, it depends on SND_SOC_CLOCK_IN and SND_SOC_CLOCK_OUT. You should call snd_soc_dai_set_sysclk() function with SND_SOC_CLOCK_OUT parameter. Check where in code is your snd_soc_dai_set_sysclk() function located and how it is called. See the below files:

    linux-kernel/sound/soc/davinci/davinci-evm.c

    linux-kernel/sound/soc/generic/simple-card.c

    deep ter said:
    It seems that the clock which has been provided is not proper.

    Which clock is not proper, mcasp0_aclkx? You want to setup 141.1KHz there, but what frequency you have there now?

    Regards,
    Pavel

  • deep ter said:
    So  I need to configure GPIO3_21 as a clock  and this clock would be input to  MCASP0_AHCLKX as shown in the schematics:

    If you are going to use aux_clk as source for aclkx, you do not need ahclkx. Using aux_clk is the "internal" case explained in AM335x TRM, section 22.3.5 Clock and Frame Sync Generators, while using ahclkx is the "mixed" case. You should use one or another, not both at the same time.

    deep ter said:

    One more doubt       "But you have bit [5] rx_active also 0 (receive disable), while we have requirement to configure mcasp0_aclkx and mcasp0_fsx signals for I/O ([5] rx_active = 1). See AM335x TRM, section 22.2.3 McASP Pin List. Please change the value in addr 0x44E10990/0x44E10994 at 0x00000020" 

    Why do we need to set 0x00000020 value as we are only using it as a Transmit? Please explain

    It is already explained in AM335x TRM section 22.2.3 McASP Pin List:

    (1)
    These signals are also used as inputs to re-time or sync data. The associated CONF_<module>_<pin>_RXACTIVE bit for these
    signals must be set to 1 to enable the inputs back to the module.

    You should configure these output pins (aclkx and fsx) as input/output for re-time and sync data purpose.

    Regards,
    Pavel

  • Hi Pavel,

    I went through the BBB schematic..I have used AHCLKX_IN as an input.

    I am now getting clocks on ACLKX and AFSX pins and I am able to .wav file through aplay.

    Now my flow is like this:
    24.576MHz(From BBB Crystal) --> AHCLKX_IN--> ACLKXCTL[4:0]--> ACLKX--> Bit Clock---> Audio Codec


    The frequency on ACLKX pin = 1.446 MHz (instead of 1.411 MHz)
    AFSX pin = 45.19KHz ( instead of 44.1 KHz)

    Due to this I am getting a lot of noise along with the audio. Do you have any clue on this?



    root@am335x-evm:/bin# aplay Tum_Hi_Ho.wav
    [ 143.097568] ***Inside the function *davinci_mcasp_startup****
    Playing WAVE 'Tum_Hi_Ho.wav' : Signed 32 bit Little Endian, Rate 44100 Hz, Stereo
    [ 143.126679] *******Inside saf775x_hw_params********
    [ 143.131645] MCASP0.XFMT/0x480380a8 = 0x10000
    [ 143.141541] Inside codec is clock and frame slave
    [ 143.150771] SND_SOC_DAIFMT_NB_NF
    [ 143.158229] MCASP->BCLK_DIV 0
    [ 143.161258] ***the value of slots =2 rate =44100 sbits=16
    [ 143.177381] davinci-mcasp 48038000.mcasp: Sample-rate is off by 400 PPM
    [ 143.184276] Inside __davinci_mcasp_set_clkdiv
    [ 143.188676] div_id=1 div = 17 explicit= 0
    [ 143.197052] *******Inside saf775x_prepare********
    [ 143.230134] In mcasp_start_tx function
    [ 143.233964] Register 0x48038010 value PFUNC_REG 0
    [ 143.238875] Register 0x48038014 value PDIR Register b4000001
    [ 143.244740] Register 0x48038018 value PDOUT Register 0
    [ 143.250082] Register 0x4803801c value PDIN Register 1c000000
    [ 143.255249] Register 0x48038020 value PDCLR Register 0
    [ 143.260504] Register 0x48038044 value GBLCTL Register 1f00
    [ 143.266107] Register 0x48038048 value AMUTE Register 0
    [ 143.271362] Register 0x480380B0 value ACLKXCTL Register b0
    [ 143.277054] Register 0x480380B4 value AHCLKXCTL Register 0

    My PINMUX registers:

    root@am335x-evm:/bin# devmem2 0x44E10990
    /dev/mem opened.
    Memory mapped at address 0xb6ff7000.
    Read at address 0x44E10990 (0xb6ff7990): 0x00000020 -------------------- RX_ACTIVE bit set to 1
    root@am335x-evm:/bin# devmem2 0x44E10994
    /dev/mem opened.
    Memory mapped at address 0xb6f78000.
    Read at address 0x44E10994 (0xb6f78994): 0x00000020 --------------RX_ACTIVE bit set to 1
    root@am335x-evm:/bin# devmem2 0x44E10998
    /dev/mem opened.
    Memory mapped at address 0xb6ff1000.
    Read at address 0x44E10998 (0xb6ff1998): 0x00000000

    Thanks 

    Deep

  • deep ter said:
    The frequency on ACLKX pin = 1.446 MHz (instead of 1.411 MHz)
    AFSX pin = 45.19KHz ( instead of 44.1 KHz)

    Due to this I am getting a lot of noise along with the audio. Do you have any clue on this?

    Your ACLKX/bclk should be 1.4112MHz, FSX should be 44.1KHz, see the below wiki:

    As you use mcasp0_ahclkx pin as input, make sure you have the correct pinmux value in conf_mcasp0_ahclkx register

    Please provide me also the latest values you have in AFSXCTL, ACLKXCTL and AHCLKXCTL registers.

    Regards,
    Pavel

  • Hi Pavel,

    I have checked the above link. This means I need to add

    ret = snd_soc_dai_set_clkdiv(cpu_dai, 1, sysclk/bclk_freq);

    ret = snd_soc_dai_set_sysclk(cpu_dai, 0, sysclk, SND_SOC_CLOCK_OUT);

    in the dummy driver's hw_params functions right?

    Yes I am using mcasp0_ahclkx as input.

    mcasp0_pins: mcasp0_pins {
    pinctrl-single,pins = <
    AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLUP | MUX_MODE0) /* mcasp0_ahcklx.mcasp0_ahclkx */
    AM33XX_IOPAD(0x990, PIN_INPUT_PULLDOWN | MUX_MODE0) /*mcasp0_aclkx.mcasp0_aclkx */
    AM33XX_IOPAD(0x994, PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0.mcasp0_fsx */
    AM33XX_IOPAD(0x998, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0.mcasp0_axr0 */
    AM33XX_IOPAD(0x86c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a11.GPIO1_27 gpio pin to enable the 24.576MHz oscillator */
    >;
    };


    Below is the register dump.


    root@am335x-evm:/bin# aplay Tum_Hi_Ho.wav
    [ 79.053725] ***Inside the function *davinci_mcasp_startup****
    Playing WAVE 'Tum_Hi_Ho.wav' : Signed 32 bit Little Endian, Rate 44100 Hz, Stereo
    [ 79.124747] davinci-mcasp 48038000.mcasp: Sample-rate is off by 400 PPM
    [ 79.191519] In mcasp_start_tx function
    [ 79.195350] Register 0x48038010 value PFUNC_REG 0
    [ 79.200262] Register 0x48038014 value PDIR Register b4000001
    [ 79.206128] Register 0x48038018 value PDOUT Register 0
    [ 79.211471] Register 0x4803801c value PDIN Register 1c000000
    [ 79.233362] Register 0x480380B0 value ACLKXCTL Register b0
    [ 79.239053] Register 0x480380B4 value AHCLKXCTL Register 0
    [ 79.242012] Register 0x480380AC value AFSXCTL Register 113

    Thanks
  • deep ter said:
    I have checked the above link. This means I need to add

    ret = snd_soc_dai_set_clkdiv(cpu_dai, 1, sysclk/bclk_freq);

    ret = snd_soc_dai_set_sysclk(cpu_dai, 0, sysclk, SND_SOC_CLOCK_OUT);

    in the dummy driver's hw_params functions right?

    Do not follow that wiki blindly (as you do), it is for 24.000MHz internal/aux clock, not for 24.576MHz external/ahclkx_in clock.

    deep ter said:
    root@am335x-evm:/bin# aplay Tum_Hi_Ho.wav
    [ 79.053725] ***Inside the function *davinci_mcasp_startup****
    Playing WAVE 'Tum_Hi_Ho.wav' : Signed 32 bit Little Endian, Rate 44100 Hz, Stereo
    [ 79.124747] davinci-mcasp 48038000.mcasp: Sample-rate is off by 400 PPM
    [ 79.191519] In mcasp_start_tx function
    [ 79.195350] Register 0x48038010 value PFUNC_REG 0
    [ 79.200262] Register 0x48038014 value PDIR Register b4000001
    [ 79.206128] Register 0x48038018 value PDOUT Register 0
    [ 79.211471] Register 0x4803801c value PDIN Register 1c000000
    [ 79.233362] Register 0x480380B0 value ACLKXCTL Register b0
    [ 79.239053] Register 0x480380B4 value AHCLKXCTL Register 0
    [ 79.242012] Register 0x480380AC value AFSXCTL Register 113

    The McASP registers values looks correct. Your issue might be in external codec.

    Can you attach a scope to the AHCLKX, ACLKX and FSX pins and check what are the frequencies there?

    Regards,
    Pavel

  • Hi Pavel,

    Can you please tell me where and how to add divider for  24.576MHz external/ahclkx_in clock.

    These are my waveforms:

    ACLKX: 

    AFSX:

    AHCLKX_IN  output i will share in sometime. I have not captured it.

    Thanks

    Deep

  • deep ter said:
    Can you please tell me where and how to add divider for  24.576MHz external/ahclkx_in clock.

    The divider for ahclkx_in clock is only one and already used, it is ACLKXCTL[4:0] CLKXDIV. I am not aware how and where you can add additional divider.

    Also with 24.576MHz source clock for ahclkx_in, ACLKX at 1.446MHz is the close we can get. I do not see how we can adjust this clock more precise.

    Regards,
    Pavel

  • This means we cannot have any internal divider  with integer value. If we are using 48KHz sampling rate.

    then  Bit clk = 16 * 2 * 48KHz

    = 1.536MHz

    and  24.576MHz / 1.536MHz = 16

    So this 16 can work. Now the problem is  can I add this  in davinci-mcasp.c. Can you please check

    davinci_mcasp_hw_params() in davinci-mcasp.c.

    By Default the sampling rate is 44.1KHz. Even If I play a 48KHz audio  the sample rate taken in mcasp-davinci.c is  44.1KHz

    Check the following logs:

    root@am335x-evm:/bin# aplay piano2.wav &

    [1] 835

    root@am335x-evm:/bin# [  631.083340] ***Inside the function *davinci_mcasp_startup****

    Playing WAVE 'piano2.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo

    [  631.105638] *******Inside saf775x_hw_params********

    [  631.110603]  MCASP0.XFMT/0x480380a8 = 0x18074

    [  631.120518] Inside codec is clock and frame slave

    [  631.132229] SND_SOC_DAIFMT_NB_NF

    [  631.135520] MCASP->BCLK_DIV 0 --------------------------------------------------------------I need to change this value. But could not find it in simple-card.c. 

    [  631.138518] ***the value of slots =2 rate =44100 sbits=16

    [  631.156016] davinci-mcasp 48038000.mcasp: Sample-rate is off by 400 PPM

    [  631.163045] Inside __davinci_mcasp_set_clkdiv

    [  631.167448] div_id=1 div = 17 explicit= 0

    [  631.176300] *******Inside saf775x_prepare********

    [  631.214703] In mcasp_start_tx function

    [  631.218535] Register  0x48038010  value PFUNC_REG 0

    [  631.223445] Register  0x48038014 value PDIR Register  b4000001

    [  631.229313] Register 0x48038018  value PDOUT Register  0

    [  631.234655] Register 0x4803801c value PDIN Register  0

    [  631.239823] Register 0x48038020 value PDCLR Register  0

    [  631.245078] Register 0x48038044 value GBLCTL Register  1f00

    [  631.250680] Register 0x48038048 value AMUTE Register  0

    [  631.255936] Register 0x480380B0  value ACLKXCTL Register  b0

    [  631.261627] Register 0x480380B4  value AHCLKXCTL Register  0

    Thanks

    Deep

  • deep ter said:

    This means we cannot have any internal divider  with integer value. If we are using 48KHz sampling rate.

    then  Bit clk = 16 * 2 * 48KHz

    = 1.536MHz

    and  24.576MHz / 1.536MHz = 16

    So this 16 can work. Now the problem is  can I add this  in davinci-mcasp.c. Can you please check

    Explore ACLKXCTL[4:0] CLKXDIV value, it is set to 0x10 (div by 17) in davinci-mcasp.c. You can change it to 0xF (div by 16). See the below functions:

    davinci_mcasp_calc_clk_div()

    __davinci_mcasp_set_clkdiv()

    deep ter said:

    By Default the sampling rate is 44.1KHz. Even If I play a 48KHz audio  the sample rate taken in mcasp-davinci.c is  44.1KHz

    Check the following logs:

    root@am335x-evm:/bin# aplay piano2.wav &

    You can pass many parameters to aplay tool, one of them is rate. Try with "aplay -h" for more info.

    Regards,
    Pavel

  • Hi Pavel,

    Now that we are using AHCLKX_IN as input to McASP. Do we need to set system-clock-frequency parameter in the device tree.

    sound {
    compatible = "simple-audio-card";
    simple-audio-card,name = "TI BeagleBone Black";
    simple-audio-card,format = "i2s";
    simple-audio-card,bitclock-master = <&sound_master>;
    simple-audio-card,frame-master = <&sound_master>;

    sound_master:simple-audio-card,cpu {
    sound-dai = <&mcasp0>;
    system-clock-frequency = <24576000>;
    };

    simple-audio-card,codec {
    sound-dai = <&saf775x>;

    I am still trying to set the CLKXDIV but not successful in doing so..

    Thanks

    Deep

  • deep ter said:
    Now that we are using AHCLKX_IN as input to McASP. Do we need to set system-clock-frequency parameter in the device tree.

    deep ter said:
    sound_master:simple-audio-card,cpu {
    sound-dai = <&mcasp0>;
    system-clock-frequency = <24576000>;
    };

    Yes, that looks correct. I would suggest you to check your sysclk freq value in McASP driver to make sure it is properly set by the "system-clock-frequency" parameter. See the below files and functions for more info:

    linux-kernel/sound/soc/generic/simple-card.c

    asoc_simple_card_sub_parse_of()

    asoc_simple_card_hw_params()

    __asoc_simple_card_dai_init()

    linux-kernel/sound/soc/soc-core.c

    snd_soc_dai_set_sysclk() - set with SND_SOC_CLOCK_IN

    linux-kernel/sound/soc/davinci/davinci-mcasp.c

    davinci_mcasp_set_sysclk()  -> check what is the final value in mcasp->sysclk_freq

    You can also enable debug mode, thus you will have more info coming from the dev_dbg() messages.

    See also "Interfacing DRA7xx Audio to Analog Codecs" applicatio note, 5.3 Example: McASP3 in I2S Mode, it is very similar to your case

  • Hi Pavel,

    Thanks for your reply.

    With setting of system-clock-frequency = <24576000>, McASP is also taking it as sysclk frequency. Checked by applying the following logs:

    root@am335x-evm:/bin# aplay  piano2.wav

    [ 4314.831400] ***Inside the function *davinci_mcasp_startup****

    Playing WAVE 'piano2.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo

    [ 4314.850910] *******Inside saf775x_hw_params********

    [ 4314.860766] Inside codec is clock and frame slave

    [ 4314.871545] SND_SOC_DAIFMT_NB_NF

    [ 4314.879142] mclk->bclk_master = 1

    [ 4314.886731] mcasp->sysclk_freq =24576000     -----------------------(Clock frequency set in the device tree)

    [ 4314.890708] MCASP->BCLK_DIV 0

    [ 4314.901643] ***the value of slots =2 rate =48000 sbits=16

    [ 4314.912198] Inside __davinci_mcasp_set_clkdiv

    [ 4314.916622] div_id=1 div = 16 explicit= 0  ----------------------------------check the divider value

    [ 4314.920575] Inside MCASP_CLKDIV_BCLK

    With the setting of this above frequency Sample rate error "davinci-mcasp 48038000.mcasp: Sample-rate is off by 400 PPM" has gone. Now not getting any such error.

    One more interesting observation:

    If I play any song having 44.1khz Sampling frequency....It automatically changes the sampling rate to 32khz so that we can get an integer divider. For clarification check the below log:

    oot@am335x-evm:/bin# aplay audiocheck1_10th_copy_converted.wav
    [ 869.270804] ***Inside the function *davinci_mcasp_startup****
    Playing WAVE 'audiocheck1_10th_copy_converted.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
    [ 869.293103] *******Inside saf775x_hw_params********
    [ 869.298072] MCASP0.XFMT/0x480380a8 = 0x18074
    [ 869.308068] Inside codec is clock and frame slave
    [ 869.317176] SND_SOC_DAIFMT_NB_NF
    [ 869.320469] mclk->bclk_master = 1
    [ 869.331535] mcasp->sysclk_freq =24576000
    [ 869.342243] MCASP->BCLK_DIV 0
    [ 869.345274] ***the value of slots =2 rate =32000 sbits=16         -----------------------------------Here the sampling frequency is changed from 44.1Kz to 32KHz
    [ 869.350712] Inside __davinci_mcasp_set_clkdiv
    [ 869.366954] div_id=1 div = 24 explicit= 0    ---------------------------check the divider value  
    [ 869.370935] Inside MCASP_CLKDIV_BCLK
    [ 869.374924] The value inside MCASP_CLKDIV_BCLK of ACLKXCTL is 0x1800b7

    I will also attach the images of sampling frequencies. One of sampling freq=48khz  another with 32Khz.

    now after getting the above sample frequencies also.. I am still getting lot of noise. Can you please confirm that now there is no issue from the processor side..so that I can focus on codec side.

    Thanks for your help Pavel !!

    Deep

  • Deep,

    Please remove your debug prints and enable dev_dbg() prints only. Then provide me the full boot up log and aplay log.

    You have 48KHz on the AFSX pin, but do you have the expected signals on ACLKX and AXR0 pins?

    Regards,
    Pavel
  • Hi Pavel,
    I will enable CONFIG_DYNAMIC_DEBUG and share you the logs.

    I can measure the signals at ACLKX pin..but how to validate the AXR0 signal. I am able to hear the audio from the codec...but along with the audio a lot of noise is there.

    Thanks
    Deep
  • Hi Pavel,

    Yes the values at ACLKX pin are coming fine. Please check the ACLKX waveform.

        ---for sampling rate 48Khz

     ---------------------------for sampling rate 44.1Khz

    I enabled CONFIG_DYNAMIC_DEBUG  in kernel and gave the following command

    echo 8 > /proc/sys/kernel/printk

    I am attaching my boot logs.

    4214.console_log.txt
    U-Boot 2016.05-g6c5519b6fc (Dec 14 2016 - 19:14:27 -0500)
    
    CPU  : AM335X-GP rev 2.1
    Model: TI AM335x BeagleBone Black
           Watchdog enabled
    DRAM:  512 MiB
    NAND:  0 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    reading uboot.env
    
    ** Unable to read "uboot.env" from mmc0:1 **
    Using default environment
    
    <ethaddr> not set. Validating first E-fuse MAC
    Net:   eth0: ethernet@4a100000
    Warning: usb_ether MAC addresses don't match:
    Address in SROM is         de:ad:be:ef:00:01
    Address in environment is  a0:f6:fd:63:a6:4d
    , eth1: usb_ether
    Press SPACE to abort autoboot in 2 seconds
    switch to partitions #0, OK
    mmc0 is current device
    SD/MMC found on device 0
    reading boot.scr
    ** Unable to read file boot.scr **
    reading uEnv.txt
    ** Unable to read file uEnv.txt **
    switch to partitions #0, OK
    mmc0 is current device
    Scanning mmc 0:1...
    switch to partitions #0, OK
    mmc0 is current device
    SD/MMC found on device 0
    3576864 bytes read in 266 ms (12.8 MiB/s)
    36630 bytes read in 59 ms (605.5 KiB/s)
    Kernel image @ 0x82000000 [ 0x000000 - 0x369420 ]
    ## Flattened Device Tree blob at 88000000
       Booting using the fdt blob at 0x88000000
       Loading Device Tree to 8fff4000, end 8fffff15 ... OK
    
    Starting kernel ...
    
    [    0.000000] Booting Linux on physical CPU 0x0
    [    0.000000] Initializing cgroup subsys cpu
    [    0.000000] Initializing cgroup subsys cpuacct
    [    0.000000] Linux version 4.4.32-gadde2ca9f8 (canary@canary-OptiPlex-3040) (gcc version 5.3.1 20160113 (Linaro GCC 5.3-2016.02) ) #54 PREEM7
    [    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
    [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [    0.000000] Machine model: TI AM335x BeagleBone Black
    [    0.000000] cma: Reserved 48 MiB at 0x9d000000
    [    0.000000] Memory policy: Data cache writeback
    [    0.000000] CPU: All CPU(s) started in SVC mode.
    [    0.000000] AM335X ES2.1 (sgx neon )
    [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 129920
    [    0.000000] Kernel command line: console=ttyO0,115200n8 root=PARTUUID=000c0d1a-02 rw rootfstype=ext4 rootwait
    [    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
    [    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
    [    0.000000] Memory: 459668K/524288K available (6723K kernel code, 366K rwdata, 2496K rodata, 272K init, 265K bss, 15468K reserved, 49152K c)
    [    0.000000] Virtual kernel memory layout:
    [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    [    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    [    0.000000]     vmalloc : 0xe0800000 - 0xff800000   ( 496 MB)
    [    0.000000]     lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
    [    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    [    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
    [    0.000000]       .text : 0xc0008000 - 0xc0909004   (9221 kB)
    [    0.000000]       .init : 0xc090a000 - 0xc094e000   ( 272 kB)
    [    0.000000]       .data : 0xc094e000 - 0xc09a9a40   ( 367 kB)
    [    0.000000]        .bss : 0xc09a9a40 - 0xc09ec158   ( 266 kB)
    [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [    0.000000] Preemptible hierarchical RCU implementation.
    [    0.000000]  Build-time adjustment of leaf fanout to 32.
    [    0.000000] NR_IRQS:16 nr_irqs:16 16
    [    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
    [    0.000000] OMAP clockevent source: timer2 at 24000000 Hz
    [    0.000014] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    [    0.000032] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
    [    0.000042] OMAP clocksource: timer1 at 24000000 Hz
    [    0.000177] clocksource_probe: no matching clocksources found
    [    0.000335] Console: colour dummy device 80x30
    [    0.000357] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
    [    0.000362] This ensures that you still see kernel messages. Please
    [    0.000366] update your kernel commandline.
    [    0.000383] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
    [    0.089261] pid_max: default: 32768 minimum: 301
    [    0.089372] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.089381] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.089987] Initializing cgroup subsys io
    [    0.090015] Initializing cgroup subsys memory
    [    0.090049] Initializing cgroup subsys devices
    [    0.090062] Initializing cgroup subsys freezer
    [    0.090076] Initializing cgroup subsys perf_event
    [    0.090086] Initializing cgroup subsys pids
    [    0.090111] CPU: Testing write buffer coherency: ok
    [    0.090466] Setting up static identity map for 0x80008200 - 0x80008258
    [    0.094244] devtmpfs: initialized
    [    0.104161] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
    [    0.117136] omap_hwmod: debugss: _wait_target_disable failed
    [    0.171938] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [    0.175474] pinctrl core: initialized pinctrl subsystem
    [    0.176653] NET: Registered protocol family 16
    [    0.178495] DMA: preallocated 256 KiB pool for atomic coherent allocations
    [    0.209252] cpuidle: using governor ladder
    [    0.239241] cpuidle: using governor menu
    [    0.243026] OMAP GPIO hardware version 0.1
    [    0.251180] hw-breakpoint: debug architecture 0x4 unsupported.
    [    0.286260] edma 49000000.edma: TI EDMA DMA engine driver
    [    0.289393] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring e
    [    0.289448] omap_i2c 4819c000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c2_pins, deferring e
    [    0.289556] media: Linux media interface: v0.10
    [    0.289611] Linux video capture interface: v2.00
    [    0.289654] pps_core: LinuxPPS API ver. 1 registered
    [    0.289660] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    [    0.289684] PTP clock support registered
    [    0.289741] EDAC MC: Ver: 3.0.0
    [    0.290742] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
    [    0.291026] Advanced Linux Sound Architecture Driver Initialized.
    [    0.292036] clocksource: Switched to clocksource timer1
    [    0.301157] NET: Registered protocol family 2
    [    0.301844] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
    [    0.301887] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    [    0.301924] TCP: Hash tables configured (established 4096 bind 4096)
    [    0.301993] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [    0.302009] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [    0.302208] NET: Registered protocol family 1
    [    0.302574] RPC: Registered named UNIX socket transport module.
    [    0.302587] RPC: Registered udp transport module.
    [    0.302592] RPC: Registered tcp transport module.
    [    0.302598] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [    0.303432] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
    [    0.305033] futex hash table entries: 256 (order: -1, 3072 bytes)
    [    0.311832] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [    0.312833] NFS: Registering the id_resolver key type
    [    0.312898] Key type id_resolver registered
    [    0.312906] Key type id_legacy registered
    [    0.312968] ntfs: driver 2.1.32 [Flags: R/O].
    [    0.316128] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
    [    0.316154] io scheduler noop registered
    [    0.316165] io scheduler deadline registered
    [    0.316299] io scheduler cfq registered (default)
    [    0.317417] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
    [    0.369809] Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
    [    0.373500] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 158, base_baud = 3000000) is a 8250
    [    0.982019] console [ttyS0] enabled
    [    0.986388] [drm] Initialized drm 1.1.0 20060810
    [    0.997301] loop: module loaded
    [    1.002576] libphy: Fixed MDIO Bus: probed
    [    1.072088] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
    [    1.078225] davinci_mdio 4a101000.mdio: detected phy mask fffffffe
    [    1.085320] libphy: 4a101000.mdio: probed
    [    1.089360] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
    [    1.099263] cpsw 4a100000.ethernet: Detected MACID = a0:f6:fd:63:a6:4b
    [    1.106045] cpsw 4a100000.ethernet: cpts: overflow check period 850
    [    1.113988] mousedev: PS/2 mouse device common for all mice
    [    1.120135] i2c /dev entries driver
    [    1.124620] cpuidle: enable-method property 'ti,am3352' found operations
    [    1.132019] omap_hsmmc 48060000.mmc: Got CD GPIO
    [    1.213386] ledtrig-cpu: registered to indicate activity on CPUs
    [    1.221817] NET: Registered protocol family 10
    [    1.227727] sit: IPv6 over IPv4 tunneling driver
    [    1.233176] NET: Registered protocol family 17
    [    1.237927] Key type dns_resolver registered
    [    1.242546] omap_voltage_late_init: Voltage driver support not added
    [    1.260735] mmc0: host does not support reading read-only switch, assuming write-enable
    [    1.275014] mmc0: new high speed SDHC card at address aaaa
    [    1.281782] mmcblk0: mmc0:aaaa SS08G 7.40 GiB 
    [    1.289530] tps65217 0-0024: TPS65217 ID 0xe version 1.2
    [    1.295046]  mmcblk0: p1 p2
    [    1.298504] at24 0-0050: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
    [    1.306018] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
    [    1.316075] at24 2-0054: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
    [    1.323311] at24 2-0055: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
    [    1.330427] at24 2-0056: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
    [    1.337592] at24 2-0057: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
    [    1.344749] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
    [    1.355761] hctosys: unable to open rtc device (rtc0)
    [    1.364206] ALSA device list:
    [    1.367213]   No soundcards found.
    [    1.387880] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    [    1.396196] VFS: Mounted root (ext4 filesystem) on device 179:2.
    [    1.402307] mmc1: MAN_BKOPS_EN bit is not set
    [    1.412340] devtmpfs: mounted
    [    1.415682] Freeing unused kernel memory: 272K (c090a000 - c094e000)
    [    1.422304] mmc1: new high speed MMC card at address 0001
    [    1.428107] This architecture does not have kernel memory protection.
    [    1.434913] mmcblk1: mmc1:0001 S10004 3.56 GiB 
    [    1.440342] mmcblk1boot0: mmc1:0001 S10004 partition 1 4.00 MiB
    [    1.446710] mmcblk1boot1: mmc1:0001 S10004 partition 2 4.00 MiB
    [    1.454163]  mmcblk1: p1 p2
    [    1.740350] systemd[1]: System time before build time, advancing clock.
    [    1.809334] random: systemd: uninitialized urandom read (16 bytes read, 16 bits of entropy available)
    [    1.827576] random: systemd: uninitialized urandom read (16 bytes read, 16 bits of entropy available)
    [    1.855346] systemd[1]: systemd 229 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCR)
    [    1.874419] systemd[1]: Detected architecture arm.
    
    Welcome to Arago 2016.10!
    
    [    1.906655] systemd[1]: Set hostname to <am335x-evm>.
    [    2.024384] random: systemd-gpt-aut: uninitialized urandom read (16 bytes read, 20 bits of entropy available)
    [    2.035555] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read, 20 bits of entropy available)
    [    2.046681] random: systemd-gpt-aut: uninitialized urandom read (16 bytes read, 20 bits of entropy available)
    [    2.067254] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read, 20 bits of entropy available)
    [    2.090876] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read, 22 bits of entropy available)
    [    2.189827] random: systemd: uninitialized urandom read (16 bytes read, 25 bits of entropy available)
    [    2.199955] random: systemd: uninitialized urandom read (16 bytes read, 25 bits of entropy available)
    [    2.211085] random: systemd: uninitialized urandom read (16 bytes read, 25 bits of entropy available)
    [    2.565009] systemd[1]: [/lib/systemd/system/gadget-init.service:15] Unknown lvalue 'ExecStopPre' in section 'Service'
    [    2.888194] systemd[1]: basic.target: Found ordering cycle on basic.target/start
    [    2.896149] systemd[1]: basic.target: Found dependency on sockets.target/start
    [    2.903702] systemd[1]: basic.target: Found dependency on rpcbind.socket/start
    [    2.911019] systemd[1]: basic.target: Found dependency on sysinit.target/start
    [    2.918392] systemd[1]: basic.target: Found dependency on alignment.service/start
    [    2.926288] systemd[1]: basic.target: Found dependency on basic.target/start
    [    2.933695] systemd[1]: basic.target: Breaking ordering cycle by deleting job sockets.target/start
    [    2.942810] systemd[1]: sockets.target: Job sockets.target/start deleted to break ordering cycle starting with basic.target/start
    [ SKIP ] Ordering cycle found, skipping Sockets
    [    2.972713] systemd[1]: alignment.service: Found ordering cycle on alignment.service/start
    [    2.981055] systemd[1]: alignment.service: Found dependency on sysinit.target/start
    [    2.988857] systemd[1]: alignment.service: Found dependency on alignment.service/start
    [    2.996878] systemd[1]: alignment.service: Breaking ordering cycle by deleting job alignment.service/start
    [    3.006633] systemd[1]: alignment.service: Job alignment.service/start deleted to break ordering cycle starting with alignment.service/start
    [ SKIP ] Ordering cycle found, skipping alignment.service
    [    3.048272] systemd[1]: Listening on Syslog Socket.
    [  OK  ] Listening on Syslog Socket.
    [    3.072816] systemd[1]: Listening on Journal Socket.
    [  OK  ] Listening on Journal Socket.
    [    3.102840] systemd[1]: Listening on udev Control Socket.
    [  OK  ] Listening on udev Control Socket.
    [    3.132446] systemd[1]: Reached target Swap.
    [  OK  ] Reached target Swap.
    [    3.153019] systemd[1]: Listening on Network Service Netlink Socket.
    [  OK  ] Listening on Network Service Netlink Socket.
    [    3.211795] systemd[1]: Created slice System Slice.
    [  OK  ] Created slice System Slice.
    [    3.246740] systemd[1]: Mounting Debug File System...
             Mounting Debug File System...
    [    3.285067] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
    [  OK  ] Started Forward Password Requests to Wall Directory Watch.
    [    3.337738] systemd[1]: Starting Setup Virtual Console...
             Starting Setup Virtual Console...
    [    3.384898] systemd[1]: Starting Create list of required static device nodes for the current kernel...
             Starting Create list of required st... nodes for the current kernel...
    [    3.461053] systemd[1]: Starting Load Kernel Modules...
             Starting Load Kernel Modules...
    [    3.479603] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
    [  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
    [    3.517714] cryptodev: driver 1.8 loaded.
    [    3.538006] systemd[1]: Mounting POSIX Message Queue File System...
             Mounting POSIX Message Queue File System...
    [    3.573016] systemd[1]: Created slice system-serial\x2dgetty.slice.
    [  OK  ] Created slice system-serial\x2dgetty.slice.
    [    3.617923] systemd[1]: Mounting Temporary Directory...
             Mounting Temporary Directory...
    [    3.652959] systemd[1]: Listening on Journal Socket (/dev/log).
    [  OK  ] Listening on Journal Socket (/dev/log).
    [    3.686768] systemd[1]: Starting Remount Root and Kernel File Systems...
             Starting Remount Root and Kernel File Systems...
    [    3.714263] systemd[1]: Created slice system-getty.slice.
    [    3.761606] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    [  OK  ] Created slice system-getty.slice.
    [    3.797008] systemd[1]: Starting Journal Service...
             Starting Journal Service...
    [    3.833878] systemd[1]: Created slice User and Session Slice.
    [  OK  ] Created slice User and Session Slice.
    [    3.848080] systemd[1]: Reached target Remote File Systems.
    [  OK  ] Reached target Remote File Systems.
    [    3.872920] systemd[1]: Listening on udev Kernel Socket.
    [  OK  ] Listening on udev Kernel Socket.
    [    3.902691] systemd[1]: Reached target Slices.
    [  OK  ] Reached target Slices.
    [    3.922995] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
    [  OK  ] Started Dispatch Password Requests to Console Directory Watch.
    [    3.942745] systemd[1]: Reached target Paths.
    [  OK  ] Reached target Paths.
    [    4.010321] systemd[1]: Mounted Debug File System.
    [  OK  ] Mounted Debug File System.
    [    4.032676] systemd[1]: Mounted POSIX Message Queue File System.
    [  OK  ] Mounted POSIX Message Queue File System.
    [    4.062559] systemd[1]: Mounted Temporary Directory.
    [  OK  ] Mounted Temporary Directory.
    [    4.093242] systemd[1]: Started Journal Service.
    [  OK  ] Started Journal Service.
    [  OK  ] Started Setup Virtual Console.
    [  OK  ] Started Create list of required sta...ce nodes for the current kernel.
    [  OK  ] Started Load Kernel Modules.
    [  OK  ] Started Remount Root and Kernel File Systems.
             Starting udev Coldplug all Devices...
             Starting Apply Kernel Variables...
             Starting Create Static Device Nodes in /dev...
             Starting Flush Journal to Persistent Storage...
    [  OK  ] Started Apply Kernel Variables.
    [  OK  ] Started Create Static Device Nodes in /dev.
    [    5.501370] systemd-journald[105]: Received request to flush runtime journal from PID 1
    [  OK  ] Started Flush Journal to Persistent Storage.
             Starting udev Kernel Device Manager...
    [  OK  ] Reached target Local File Systems (Pre).
             Mounting /media/ram...
             Mounting /var/volatile...
    [  OK  ] Mounted /var/volatile.
    [  OK  ] Mounted /media/ram.
    [  OK  ] Started udev Kernel Device Manager.
    [  OK  ] Started udev Coldplug all Devices.
    [    6.835265] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
    [  OK  ] Reached target Local File Systems.
             Starting Create Volatile Files and Directories...
    [    6.909209] 47401300.usb-phy supply vcc not found, using dummy regulator
             Starting Load/Save Random Seed...
    [    7.014297] 47401b00.usb-phy supply vcc not found, using dummy regulator
    [    7.214208] omap_rtc 44e3e000.rtc: rtc core: registered 44e3e000.rtc as rtc0
    [  OK  ] Started Load/Save Random Seed.
    [  OK  ] Started Create Volatile Files and Directories.
    [  OK  ] Found device /dev/ttyS0.
    [    7.440524] ******The i2c_client name is saf775x
    [    7.509019] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
    [    7.531190] Memory is allocated
    [    7.543710] ****After Regmap**********
    [    7.900498] omap-sham 53100000.sham: hw accel on OMAP rev 4.3
    [    8.116411]  remoteproc0: wkup_m3 is available
    [    8.142345]  remoteproc0: Note: remoteproc is still under development and considered experimental.
    [    8.151374]  remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [    8.691573] omap-aes 53500000.aes: OMAP AES hw accel rev: 3.2
             Starting Network Time Synchronization...
             Starting Update UTMP about System Boot/Shutdown...
    [    9.179191] [drm] Initialized pvr 1.14.3699939 20110701 on minor 0
    [    9.232623] ti-pruss 4a300000.pruss: creating PRU cores and other child platform devices
    [    9.281510]  remoteproc0: powering up wkup_m3
    [  OK  ] Started Network Time Synchronization.
    [    9.329001] irq: no irq domain found for /ocp/pruss@4a300000/intc@4a320000 !
    [    9.365399]  remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217280
    [    9.469633]  remoteproc0: remote processor wkup_m3 is now up
    [    9.469664] wkup_m3_ipc 44e11324.wkup_m3_ipc: CM3 Firmware Version = 0x192
    [    9.528083] irq: no irq domain found for /ocp/pruss@4a300000/intc@4a320000 !
    [    9.618151] PM: bootloader does not support rtc-only!
    [    9.668710]  remoteproc1: 4a334000.pru0 is available
    [    9.709838] *****Value of bit1 : 0
    [    9.767878] *****Value of frame1 : 0
    [    9.771601] *****Value of format : 1001
    [    9.789724]  remoteproc1: Note: remoteproc is still under development and considered experimental.
    [    9.862931] ***Inside Codec probe***
    [    9.879828]  remoteproc1: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [    9.908498] asoc-simple-card sound: saf775x-codec <-> 48038000.mcasp mapping ok
    [   10.022772]  remoteproc1: registered virtio0 (type 7)
    [   10.092326] pru-rproc 4a334000.pru0: PRU rproc node /ocp/pruss@4a300000/pru0@4a334000 probed successfully
    [   10.107893] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
    [   10.172753]  remoteproc2: 4a338000.pru1 is available
    [   10.177764]  remoteproc2: Note: remoteproc is still under development and considered experimental.
    [   10.219615] FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
    [   10.386219]  remoteproc2: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [   10.547570]  remoteproc2: registered virtio1 (type 7)
    [   10.555282] EXT4-fs (mmcblk1p2): recovery complete
    [   10.560129] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
    [   10.592582] pru-rproc 4a338000.pru1: PRU rproc node /ocp/pruss@4a300000/pru1@4a338000 probed successfully
    [  OK  ] Found device /dev/ttyS3.
    [  OK  ] Started Update UTMP about System Boot/Shutdown.
    [   11.282156] random: nonblocking pool is initialized
    [  OK  ] Found device /dev/mmcblk0p1.
    [  OK  ] Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
             Starting Synchronize System and HW clocks...
    [  OK  ] Reached target System Time Synchronized.
    [  OK  ] Started Synchronize System and HW clocks.
    [   13.013906] usbcore: registered new interface driver usbfs
    [   13.019510] usbcore: registered new interface driver hub
    [   13.088005] usbcore: registered new device driver usb
    [   13.283167]  remoteproc1: powering up 4a334000.pru0
    [   13.305598]  remoteproc1: Booting fw image am335x-pru0-fw, size 75576
    [   13.323635] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
    [   13.342782] ti-pruss 4a300000.pruss: configured system_events = 0x0000000000030000 intr_channels = 0x00000005 host_intr = 0x00000005
    [   13.358096] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
    [   13.394480] hub 1-0:1.0: USB hub found
    [   13.398558]  remoteproc1: remote processor 4a334000.pru0 is now up
    [   13.406711] hub 1-0:1.0: 1 port detected
    [   13.411504] virtio_rpmsg_bus virtio0: creating channel rpmsg-pru addr 0x1e
    [   13.422322] virtio_rpmsg_bus virtio0: rpmsg host is online
    [   13.442736]  remoteproc2: powering up 4a338000.pru1
    [   13.448172]  remoteproc2: Booting fw image am335x-pru1-fw, size 75576
    [   13.497680] ti-pruss 4a300000.pruss: configured system_events = 0x00000000000c0000 intr_channels = 0x0000000a host_intr = 0x0000000a
    [   13.557896]  remoteproc2: remote processor 4a338000.pru1 is now up
    [   13.566102] virtio_rpmsg_bus virtio1: creating channel rpmsg-pru addr 0x1f
    [   13.575796] virtio_rpmsg_bus virtio1: rpmsg host is online
    [   13.651314] rpmsg_pru rpmsg0: new rpmsg_pru device: /dev/rpmsg_pru30
    [   13.670323] rpmsg_pru rpmsg1: new rpmsg_pru device: /dev/rpmsg_pru31
    [  OK  ] Reached target Sound Card.
    [  OK  ] Reached target System Initialization.
    [  OK  ] Listening on dropbear.socket.
    [  OK  ] Reached target Basic System.
             Starting Start USB gadget...
             Starting uim-sysfs.service...
             Starting Print notice about GPLv3 packages...
    [  OK  ] Started System Logging Service.
             Starting Permit User Sessions...
             Starting Save/Restore Sound Card State...
    [  OK  ] Started Kernel Logging Service.
    [  OK  ] Listening on Avahi mDNS/DNS-SD Stack Activation Socket.
    [  OK  ] Listening on D-Bus System Message Bus Socket.
             Starting Avahi mDNS/DNS-SD Stack...
    [  OK  ] Started D-Bus System Message Bus.
    [   14.860714] using random self ethernet address
    [   14.877253] using random host ethernet address
    [   14.881755] using host ethernet address: A0:F6:FD:63:A6:4D
    [   14.942896] using random self ethernet address
    [   14.967302] using random host ethernet address
    [   14.994314] using host ethernet address: A0:F6:FD:63:A6:4D
    [   15.039530] usb0: HOST MAC a0:f6:fd:63:a6:4d
    [   15.083826] usb0: MAC 3a:13:fc:72:4c:64
    [  OK  ] Started Avahi mDNS/DNS-SD Stack.
             Starting Network Service...
             Starting Telephony service...
    [  OK  ] Started Daily Cleanup of Temporary Directories.
    [  OK  ] Reached target Timers.
    [   15.248303] Mass Storage Function, version: 2009/09/11
    [  OK  ] Started strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf.
    [   15.292810] LUN: removable file: (no medium)
             [   15.351759] LUN: removable read only file: /dev/mmcblk0p1
    Starting Login Service...
    [  OK  ] Listening on RPCbind Server Activation Socket.
    [  OK  ] Started Permit User Sessions.
    
    [   15.433996] Number of LUNs=1
    [   15.469560] g_multi gadget: Multifunction Composite Gadget
    [  OK  ] Started Save/Restore Sound Card State.
    [   15.556501] g_multi gadget: g_multi ready
    [   15.659310] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
    [  OK  ] Started Network Service.
    [  OK  ] Found device /dev/ttyGS0.
    [   15.833826] net eth0: initializing cpsw version 1.12 (0)
    [   15.868049] net eth0: initialized cpsw ale version 1.4
    [   15.897930] net eth0: ALE Table size 1024
    [   15.941539] net eth0: phy found : id is : 0x7c0f1
    [   15.969210] libphy: PHY 4a101000.mdio:01 not found
    [   15.994927] net eth0: phy "4a101000.mdio:01" not found on slave 1, err -19
    [   16.114630] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    [   16.123797] Bluetooth: Core ver 2.21
    [   16.172398] NET: Registered protocol family 31
    [   16.176890] Bluetooth: HCI device and connection manager initialized
    [   16.285511] Bluetooth: HCI socket layer initialized
    [   16.312953] Bluetooth: L2CAP socket layer initialized
    [   16.360490] NET: Registered protocol family 15
    [   16.370388] Bluetooth: SCO socket layer initialized
    [  OK  ] Started Start USB gadget.
    [   17.274725] Initializing XFRM netlink socket
    [  OK  ] Started Telephony service.
    [  OK  ] Started Login Service.
             Mounting Configuration File System...
    [  OK  ] Reached target Network.
             Starting Network Name Resolution...
             Starting Lightning Fast Webserver With Light System Requirements...
    [  OK  ] Started Serial Getty on ttyS3.
    [  OK  ] Started Serial Getty on ttyGS0.
    [  OK  ] Started Serial Getty on ttyS0.
    [  OK  ] Started Getty on tty1.
    [  OK  ] Mounted Configuration File System.
    [  OK  ] Started Network Name Resolution.
    [  OK  ] Started Lightning Fast Webserver With Light System Requirements.
    [  OK  ] Started uim-sysfs.service.
             Starting rc.pvr.service...
    [   21.646473] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
    [  OK  ] Started rc.pvr.service.
    ***************************************************************
    ***************************************************************
    NOTICE: This file system contains the following GPLv3 packages:
            autoconf
            binutils
            bison-dev
            bison
            cpp-symlinks
            cpp
            dosfstools
            g++-symlinks
            g++
            gawk-dev
            gawk
            gcc-symlinks
            gcc
            gdb
            gdbserver
            gstreamer1.0-libav
            hidapi
            libcairo-perf-utils
            libgmp10
            libidn11
            libmpc3
            libmpfr4
            m4-dev
            m4
            make
            nettle
            swig-dev
            swig
    
    If you do not wish to distribute GPLv3 components please remove
    the above packages prior to distribution.  This can be done using
    the opkg remove command.  i.e.:
        opkg remove <package>
    Where <package> is the name printed in the list above
    
    NOTE: If the package is a dependency of another package you
          will be notified of the dependent packages.  You should
          use the --force-removal-of-dependent-packages option to
          also remove the dependent packages as well
    ***************************************************************
    ***************************************************************
             Starting weston.service...
    [  OK  ] Started Print notice about GPLv3 packages.
    [  OK  ] Started weston.service.
             Starting telnetd.service...
    [  OK  ] Started telnetd.service.
             Starting thttpd.service...
             Starting busybox-udhcpd.service...
    [  OK  ] Started busybox-udhcpd.service.
    [  OK  ] Started thttpd.service.
             Starting rng-tools.service...
    [  OK  ] Started rng-tools.service.
             Starting matrix-gui-2.0.service...
    [  OK  ] Started matrix-gui-2.0.service.
             Starting thermal-zone-init.service...
             Starting parse-ip.service...
    [  OK  ] Started thermal-zone-init.service.
    [  OK  ] Started parse-ip.service.
    
     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            
    
    Arago Project http://arago-project.org am335x-evm ttyS0
    
    Arago 2016.10 am335x-evm ttyS0
    
    am335x-evm login: 
     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            
    
    Arago Project http://arago-project.org am335x-evm ttyS0
    
    Arago 2016.10 am335x-evm ttyS0
    
    am335x-evm login: 
     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            
    
    Arago Project http://arago-project.org am335x-evm ttyS0
    
    Arago 2016.10 am335x-evm ttyS0
    
    am335x-evm login: 
     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            
    
    Arago Project http://arago-project.org am335x-evm ttyS0
    
    Arago 2016.10 am335x-evm ttyS0
    
    am335x-evm login: root
    root@am335x-evm:~# echo 8 > /proc/sys/kernel/printk
    root@am335x-evm:~# cd /sys/class/gpio/
    root@am335x-evm:/sys/class/gpio# echo 59 > export 
    root@am335x-evm:/sys/class/gpio# echo out > direction
    -sh: direction: Permission denied
    root@am335x-evm:/sys/class/gpio# echo out > direction
    root@am335x-evm:/sys/class/gpio# cd gpio59
    root@am335x-evm:/sys/class/gpio/gpio59# echo out > direction 
    root@am335x-evm:/sys/class/gpio/gpio59# echo 1 > value 
    root@am335x-evm:/sys/class/gpio/gpio59# cd
    root@am335x-evm:~# cd /bin/   
    root@am335x-evm:/bin# ls
    Tum_Hi_Ho.wav                        kill.procps                          rm
    ash                                  kill.util-linux                      rmdir
    audiocheck1_10th_copy_converted.wav  kmod                                 run-parts
    bash                                 ln                                   sed
    busybox                              login                                sh
    busybox.nosuid                       login.shadow                         sleep
    busybox.suid                         loginctl                             stat
    cat                                  ls                                   stty
    chattr                               lsmod                                su
    chattr.e2fsprogs                     lsmod.kmod                           su.shadow
    chgrp                                machinectl                           su.util-linux
    chmod                                mkdir                                sync
    chown                                mknod                                systemctl
    cp                                   mktemp                               systemd-ask-password
    cpio                                 more                                 systemd-escape
    date                                 more.util-linux                      systemd-firstboot
    dd                                   mount                                systemd-hwdb
    df                                   mount.util-linux                     systemd-inhibit
    dmesg                                mountpoint                           systemd-machine-id-setup
    dmesg.util-linux                     mountpoint.util-linux                systemd-notify
    dnsdomainname                        mpstat                               systemd-tmpfiles
    dumpkmap                             mv                                   systemd-tty-ask-password-agent
    echo                                 netstat                              tar
    egrep                                networkctl                           touch
    false                                nice                                 true
    fatattr                              piano2.wav                           udevadm
    fgrep                                pidof                                umount
    getopt                               pidof.procps                         umount.util-linux
    grep                                 ping                                 uname
    gunzip                               ping6                                usleep
    gzip                                 ps                                   vi
    hostname                             ps.procps                            watch
    journalctl                           pwd                                  watch.procps
    kill                                 rev                                  zcat
    root@am335x-evm:/bin# aplay pi
    piano2.wav    pidof         pidof.procps  ping          ping6         
    root@am335x-evm:/bin# aplay pi
    piano2.wav    pidof         pidof.procps  ping          ping6         
    root@am335x-evm:/bin# aplay piano2.wav 
    Playing WAVE 'piano2.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    root@am335x-evm:/bin# aplay piano2.wav 
    Playing WAVE 'piano2.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    root@am335x-evm:/bin# 
    root@am335x-evm:/bin# 
    root@am335x-evm:/bin# 
    root@am335x-evm:/bin# dmesg -n 8
    root@am335x-evm:/bin# aplay piano2.wav 
    Playing WAVE 'piano2.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    root@am335x-evm:/bin# aplay audiocheck1_10th_copy_converted.wav
    Playing WAVE 'audiocheck1_10th_copy_converted.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
    root@am335x-evm:/bin# aplay audiocheck1_10th_copy_converted.wav
    Playing WAVE 'audiocheck1_10th_copy_converted.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
    root@am335x-evm:/bin# aplay audiocheck1_10th_copy_converted.wav
    Playing WAVE 'audiocheck1_10th_copy_converted.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
    root@am335x-evm:/bin# aplay audiocheck1_10th_copy_converted.wav
    Playing WAVE 'audiocheck1_10th_copy_converted.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
    root@am335x-evm:/bin# aplay piano2.wav 
    Playing WAVE 'piano2.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    root@am335x-evm:/bin# aplay piano2.wav 
    Playing WAVE 'piano2.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    root@am335x-evm:/bin# aplay piano2.wav 
    Playing WAVE 'piano2.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    root@am335x-evm:/bin# aplay audiocheck1_10th_copy_converted.wav
    Playing WAVE 'audiocheck1_10th_copy_converted.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
    
    



    Thanks,
    Deep

  • deep ter said:
    I will enable CONFIG_DYNAMIC_DEBUG and share you the logs.

    OK

    deep ter said:
    I can measure the signals at ACLKX pin..but how to validate the AXR0 signal

    The AXR0 pin is used for audio data transmit. You can check AM335x datasheet and TRM for what to expect on that pin. See the below figures:

    AM335x datasheet, Figure 7-87. McASP Output Timing
    AM335x TRM, Figure 22-10. Inter-Integrated Sound (I2S) Format

    You can also run audio playback test on AM335x EVM or StarterKit and monitor the aclkx/afsx/axr0 pins to see what they have when system runs fine.

    You can also run audio playback test on AM335x BeagleBoneBlack HDMI and monitor the aclkx/afsx/axr0 pins to see what they have when system runs fine.

    deep ter said:
    I am able to hear the audio from the codec...but along with the audio a lot of noise is there.

    Check if some error (like buffer underflow/overflow) is logged in McASP registers when noise occur. Check also system resources (CPU load, memory usage) are available for the audio application (system is NOT running out of resources) . See if the below pointers will be in help:

  • Hi Pavel,

    Please check the logs attached .. Although I have enabled CONFIG_DYNAMIC_DEBUG.. i did not get any logs.. I had attached my logs in the previous message.

    Thanks
    Deep
  • deep ter said:
    Yes the values at ACLKX pin are coming fine. Please check the ACLKX waveform.

    deep ter said:
     ---for sampling rate 48Khz

    Looks correct. You have 24.576MHz source clock divided by 16 to produce 1.536MHz bit clock for 48KHz sample rate.This is aligned with the equation for 16-bit stereo (2 channels) audio:

    bclk = channels * SampleRate * BitsPerSample = 2 * 48K * 16

    Can you confirm you have ACLKXCTL[4:0] CLKXDIV = 0x0F (div by 16) in this case?


    deep ter said:
    ---------------------------for sampling rate 44.1Khz


    This doesn't look correct. The reason is that you can not produce the correct bit clock (1.4112 MHz) from 24.576MHz source clock. You can try changing the source clock from external 24.576 to internal aux_clk in order to produce the correct bit clock.

    deep ter said:
    I enabled CONFIG_DYNAMIC_DEBUG  in kernel and gave the following command

    See the below wiki on details regarding dynamic debug enable:

    processors.wiki.ti.com/.../WL12xx_NLCP_Driver_Debug

    See also:

    deep ter said:
    I am attaching my boot logs

    Can you also type "aplay -l" and provide me the result.

    Regards,
    Pavel

  • Hi Pavel,

    On your previous query ,

    "Can you confirm you have ACLKXCTL[4:0] CLKXDIV = 0x0F (div by 16) in this case? "

    Yes the divider in the case of 48khz is 16.

    Register 0x480380B0 value of ACLKXCTL af (Hence the diver is 16)


    Now if I am changing the clock source to AHCLKX_IN from external 24.576MHz oscillator to AUX_CLK .. then this will be my device tree changes.


    sound_master:simple-audio-card,cpu {
    sound-dai = <&mcasp0>;
    system-clock-frequency = <sys_clkin_ck>; -------changed from 24.576MHz to sys_clk_in
    };

    simple-audio-card,codec {
    sound-dai = <&saf775x>;
    };

    Can you please confirm that this change is fine?

    Also I will share you the aplay -l logs after I prepare my setup.



    Thanks
    Deep
  • deep ter said:
    Now if I am changing the clock source to AHCLKX_IN from external 24.576MHz oscillator to AUX_CLK .. then this will be my device tree changes.


    sound_master:simple-audio-card,cpu {
    sound-dai = <&mcasp0>;
    system-clock-frequency = <sys_clkin_ck>; -------changed from 24.576MHz to sys_clk_in
    };

    simple-audio-card,codec {
    sound-dai = <&saf775x>;
    };

    Can you please confirm that this change is fine?

    No, this not seems correct to me by two reasons:

    1. aux_clk is NOT sys_clkin_ck, aux_clk is mcasp0_fck

    2. In AM335x EVM and SK aux_clk is used, but no need for such entry in DTS file

    In AM335x EVM and SK we have:

    am335x-evm.dts

    simple-audio-card,cpu {
                sound-dai = <&mcasp1>;
            };

            sound_master: simple-audio-card,codec {
                sound-dai = <&tlv320aic3106>;
                system-clock-frequency = <12000000>;
            };

    am335x-evmsk.dts

    simple-audio-card,cpu {
                sound-dai = <&mcasp1>;
            };

            sound_master: simple-audio-card,codec {
                sound-dai = <&tlv320aic3106>;
                system-clock-frequency = <24000000>;
            };

    As you see we do not have such entry as system-clock-frequency for simple-audio-card,cpu node.

    In AM335x BBB we have:

    am335x-boneblack.dts

    clk_mcasp0_fixed: clk_mcasp0_fixed {
            #clock-cells = <0>;
            compatible = "fixed-clock";
            clock-frequency = <24576000>;
        };

        clk_mcasp0: clk_mcasp0 {
            #clock-cells = <0>;
            compatible = "gpio-gate-clock";
            clocks = <&clk_mcasp0_fixed>;
            enable-gpios = <&gpio1 27 0>; /* BeagleBone Black Clk enable on GPIO1_27 */
        };
    dailink0_master: simple-audio-card,cpu {
                sound-dai = <&mcasp0>;
                clocks = <&clk_mcasp0>;
            };

            simple-audio-card,codec {
                sound-dai = <&tda19988>;
            };

    Here we provide 24.576MHz to McASP0 AHCLKX input, thus we can only produce 48KHz, 96KHz and 192KHz sample rate for TDA19988 HDMI audio.

    Regards,
    Pavel

  • Hi Pavel,

    I tried two options:

    1) Using Internal clock:
    sound {
    compatible = "simple-audio-card";
    simple-audio-card,name = "TI BeagleBone Black";
    simple-audio-card,format = "i2s";
    simple-audio-card,bitclock-master = <&sound_master>;
    simple-audio-card,frame-master = <&sound_master>;

    sound_master:simple-audio-card,cpu {
    sound-dai = <&mcasp0>;
    clocks = <&mcasp0_fck>; ----------------------------(Changed from 24576000 to mcasp0_fck and changed the node name
    from system-clk-frequency to clocks)

    };

    simple-audio-card,codec {
    sound-dai = <&saf775x>;
    };
    };
    };

    root@am335x-evm:/bin# aplay audiocheck1_10th_copy_converted.wav
    Playing WAVE 'audiocheck1_10th_copy_converted.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
    [ 59.376201] davinci-mcasp 48038000.mcasp: Sample-rate is off by 400 PPM
    aplay: pcm_write:1940: write error: Input/output error

    "Got an i/p output Error"

    There was no clock at the ACLKX pin.. Ahclkx_in is still configured as i/p as it was previously configured. Still aux clock is not being used.
    Is there any other setting to use the mcasp functional clock.


    2) Using the external clock I used the same settings given in am335x-boneblack.dts
    {

    clk_mcasp0_fixed: clk_mcasp0_fixed {
    #clock-cells = <0>;
    compatible = "fixed-clock";
    clock-frequency = <24576000>;
    };

    clk_mcasp0: clk_mcasp0 {
    #clock-cells = <0>;
    compatible = "gpio-gate-clock";
    clocks = <&clk_mcasp0_fixed>;
    enable-gpios = <&gpio1 27 0>; /* BeagleBone Black Clk enable on GPIO1_27 */
    };

    sound {
    compatible = "simple-audio-card";
    simple-audio-card,name = "TI BeagleBone Black";
    simple-audio-card,format = "i2s";
    simple-audio-card,bitclock-master = <&sound_master>;
    simple-audio-card,frame-master = <&sound_master>;

    sound_master:simple-audio-card,cpu {
    sound-dai = <&mcasp0>;
    clocks = <&clk_mcasp0>;

    };

    simple-audio-card,codec {
    sound-dai = <&saf775x>;
    }

    In this case clocks came but with the same noise and frequency.

    root@am335x-evm:/bin# aplay audiocheck1_10th_copy_converted.wav
    Playing WAVE 'audiocheck1_10th_copy_converted.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

    Thanks,
    Deep
  • deep ter said:
    There was no clock at the ACLKX pin.. Ahclkx_in is still configured as i/p as it was previously configured. Still aux clock is not being used.
    Is there any other setting to use the mcasp functional clock.

    Use SND_SOC_CLOCK_OUT parameter with snd_soc_dai_set_sysclk()

    deep ter said:
    clock-frequency = <24576000>;

    deep ter said:
    Playing WAVE 'audiocheck1_10th_copy_converted.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

    44100 Hz sample rate is NOT supported with 24576000 Hz clock on AHCLKX_IN

    Regards,
    Pavel

  • Hi Pavel,



    Using the external clock I used the same settings given in am335x-boneblack.dts
    {

    clk_mcasp0_fixed: clk_mcasp0_fixed {
    #clock-cells = <0>;
    compatible = "fixed-clock";
    clock-frequency = <24576000>;
    };

    clk_mcasp0: clk_mcasp0 {
    #clock-cells = <0>;
    compatible = "gpio-gate-clock";
    clocks = <&clk_mcasp0_fixed>;
    enable-gpios = <&gpio1 27 0>; /* BeagleBone Black Clk enable on GPIO1_27 */
    };

    sound {
    compatible = "simple-audio-card";
    simple-audio-card,name = "TI BeagleBone Black";
    simple-audio-card,format = "i2s";
    simple-audio-card,bitclock-master = <&sound_master>;
    simple-audio-card,frame-master = <&sound_master>;

    sound_master:simple-audio-card,cpu {
    sound-dai = <&mcasp0>;
    clocks = <&clk_mcasp0>;

    };

    simple-audio-card,codec {
    sound-dai = <&saf775x>;
    }


    This is working fine from the processor side. The issue was from the Dirana3 side. The format which we need to set was asynchronous Philips mode input instead of 16bit LE . In this mode the Dirana3 can take input of any frequency word clock (32Khz,48Khz) and it can use its Sample rate convertor to make it 44.1Khz

    Thank you for all your support. I will come back to you when i start with the capturing of data

    THanks,
    Deep
  • deep ter said:
    In this mode the Dirana3 can take input of any frequency word clock (32Khz,48Khz) and it can use its Sample rate convertor to make it 44.1Khz

    That sounds reasonable. TI Audio Codecs works the same way, they have internal PLLs to produce variable clocks/rates.

    Regards,
    Pavel