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.

PROCESSOR-SDK-AM62X: Regarding Clock generation from CPU pin

Part Number: PROCESSOR-SDK-AM62X
Other Parts Discussed in Thread: CLOCKTREETOOL, SYSCONFIG, AM625

Hi TI Team,

In one of the our custom design, We have used B15 pin as a function of AUDIO_EXT_REFCLK1 of am6254 processor for the clock generation to use it externally. I need 12MHz or 12.28MHz clock output from this pin. Can you please suggest us software / device tree changes for the same?

Thanks,

Maulik

  • Hi Maulik,

    I am assuming you are using McASP as master for generating the MCLK via (AUDIO_EXT_REFCLK1). Is my understanding correct?

    The AM62x is not able to source a 24.576MHz or 22.5792MHz clock, It only support reference clock of 25MHz.  You can reconfigure one of the PLLs to operate in fractional mode and get close, but this is not supported because it would cause other peripherals to operate at the incorrect frequency.

     so you will need to use a Codec that can generate the correct bit clock and act as the bit clock master.

    Hope this other thread can be of use for your design: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1175479/processor-sdk-am62x-output-audio_ext_refclk0-as-mclk-for-codec-and-mcbsp/4436910?tisearch=e2e-sitesearch&keymatch=AUDIO_EXT_REFCLK#4436910

    Hope this helps.

    Best Regards

    Suren

  • Hi Suren,

    Thank you for the update. I don't want to use Codec that can generate correct bit clock act as the bit clock master. I want to give mclk of 12MHz/25MHz externally from this Pin "B15" to the codec. Is it possible or not ? And If possible then can you suggest me the device tree changes.

    Thanks,

    Maulik

  • Hi Maulik,

    It should be possible. Although in our EVM's McASP is being used as Slave and Codec is the Master.

    Your DTS file should be something like this assuming its McASPx  where x is to which McASP you are interfacing the codec:

    sound_master: simple-audio-card,cpu {
    sound-dai = <&mcaspx>;
    bitclock-master;
    frame-master;
    system-clock-frequency = <25000000>;
    system-clock-direction-out;

    You should be able to see B15 to have a clock of 25MHz. 

    You can also use the CTT(Clock Tree tool) to configure and design as per your requirements.

    Let me know if this helps.

    Best Regards

    Suren

  • Hi Suren,

    I tried the device tree changes you suggested but still I am unable to get the frequency in B15 pin. I attached sound node text file here for your reference purpose. Let me know if any more changes required in device tree.

    Also I visited "https://www.ti.com/tool/CLOCKTREETOOL"  but i am unable to see support of am6254 processor support with this tool.

            sound {
                    compatible = "simple-audio-card";
                    simple-audio-card,name = "sm2s-am62x";
                    simple-audio-card,format = "i2s";
                    simple-audio-card,bitclock-master = <&dailink_master>;
                    simple-audio-card,frame-master = <&dailink_master>;
                    simple-audio-card,widgets =
                            "Headphone",    "Headphone Jack",
                            "Line", "Line In",
                            "Microphone",   "Microphone Jack";
    
                    simple-audio-card,audio-routing = "Mic1", "Mic Bias 1",
                                                      "MIC1", "Mic 1",
                                                      "Headphone Jack", "HPL",
                                                      "Headphone Jack", "HPR",
                                                      "Speaker", "LINE",
                                                      "Ext Spk", "Line In",
                                                      "Line", "Mic Bias";
    
    
                    simple-audio-card,cpu {
                            sound-dai = <&mcasp0>;
                            bitclock-master;
                            frame-master;
                            system-clock-frequency = <12000000>;
                            system-clock-direction-out;
                    };
    
                    dailink_master: simple-audio-card,codec {
                            sound-dai = <&da7213_codec>;
                    };
            };
    
    

    Thanks,

    Maulik

  • Hi Maulik,

    Have you tried to select AM62x as the device on the latest sysconfig tool and try to design your system. 

    I was able to get this with the latest sysconfig tool:

    &main_pmx0 {
    mymcasp1_pins_default: mymcasp1-pins-default {
    pinctrl-single,pins = <
    AM62X_IOPAD(0x0090, PIN_INPUT, 2) /* (K17) GPMC0_BE0n_CLE.MCASP1_ACLKX */
    AM62X_IOPAD(0x0098, PIN_INPUT, 2) /* (P21) GPMC0_WAIT0.MCASP1_AFSX */
    AM62X_IOPAD(0x008c, PIN_INPUT, 2) /* (J17) GPMC0_WEn.MCASP1_AXR0 */
    >;
    };
    mysystem1_pins_default: mysystem1-pins-default {
    pinctrl-single,pins = <
    AM62X_IOPAD(0x01a0, PIN_OUTPUT, 2) /* (D18) MCASP0_AXR0.AUDIO_EXT_REFCLK0 */
    AM62X_IOPAD(0x0250, PIN_OUTPUT, 0) /* (E13) PORz_OUT */
    AM62X_IOPAD(0x024c, PIN_OUTPUT, 0) /* (E14) RESETSTATz */
    >;
    };
    };

    Hope this helps.

    Best Regards

    Suren

  • Hi Suren,

    Yes I already tried with sysconfig. But still I am not getting frequency at B15 pin.

    &k3_clks {
    /* Confiure AUDIO_EXT_REFCLK2 pin as output */
    pinctrl-names = "default";
    pinctrl-0 = <&masterclk_pins_default>;
    };

    masterclk_pins_default: masterclk-pins-default {
    pinctrl-single,pins = <
    AM62X_IOPAD(0x01d4, PIN_OUTPUT, 5) /*(B15) UART0_RTSn.AUDIO_EXT_REFCLK1*/
    >;
    };

    Thanks,

    Maulik

  • Hi Maulik,

    Since you are expecting MCLK to codec to be driven from AM625, Is there a problem to make McASP as master?

    If you want to make McASP as master, then just add "system-clock-direction-out" in the DTS file and make cpu as the dai master.  In the file davinci-mcasp.c, there is a function called davinci_mcasp_set_sysclk and "system-clock-direction-out" lets the driver select AUXCLK as MCLK.

    Also you could see information on entire clocks in the system using k3conf utility on our SDK.

    Let me know how it goes.

    Best Regards

    Suren

  • Hi Suren,

    I already added system-clock-direction-out in my device tree. Still not able to get frequency at B15 pin. I have attached device tree related changes here. Let me correct if I missed anything or anything needs to modify.

    sound {
                    compatible = "simple-audio-card";
                    simple-audio-card,name = "sm2s-am62x-card1";
                    simple-audio-card,format = "i2s";
                    simple-audio-card,bitclock-master = <&dailink_master>;
                    simple-audio-card,frame-master = <&dailink_master>;
                    simple-audio-card,widgets =
                            "Headphone",    "Headphone Jack",
                            "Line", "Line In",
                            "Microphone",   "Microphone Jack";
    
                    simple-audio-card,audio-routing = "Mic1", "Mic Bias 1",
                                                      "MIC1", "Mic 1",
                                                      "Headphone Jack", "HPL",
                                                      "Headphone Jack", "HPR",
                                                      "Speaker", "LINE",
                                                      "Ext Spk", "Line In",
                                                      "Line", "Mic Bias";
    
    
                    simple-audio-card,cpu {
                            sound-dai = <&mcasp0>;
                            bitclock-master;
                            frame-master;
                            system-clock-frequency = <12000000>;
                            system-clock-direction-out;
                    };
    
                    dailink_master: simple-audio-card,codec {
                            sound-dai = <&da7213_codec>;
                    };
    };
    
    
    
    main_mcasp0_pins_default: main-mcasp0-pins-default {
                    pinctrl-single,pins = <
                            AM62X_IOPAD(0x01a4, PIN_INPUT, 0) /* (B20) MCASP0_ACLKX.MCASP0_ACLKX */
                            AM62X_IOPAD(0x01a8, PIN_INPUT, 0) /* (D20) MCASP0_AFSX.MCASP0_AFSX */
                            AM62X_IOPAD(0x01a0, PIN_OUTPUT, 0)/* (E18) MCASP0_AXR0.MCASP0_AXR0 */
                            AM62X_IOPAD(0x019c, PIN_INPUT, 0) /* (B18) MCASP0_AXR1.MCASP0_AXR1 */
    
                    >;
    };
    
    
    &mcasp0 {
            status = "okay";
            #sound-dai-cells = <0>;
    
            pinctrl-names = "default";
            pinctrl-0 = <&main_mcasp0_pins_default>;
            op-mode = <0>;
            tdm-slots = <2>;
    
            serial-dir = <  
                   1 0 2 0
                   0 0 0 0
                   0 0 0 0
                   0 0 0 0
            >;
    
            tx-num-evt = <32>;
            rx-num-evt = <32>;
    
    };
    
    
    

    Thanks,

    Maulik

  • Hi Maulik,

    Can you modify the Padconfig register to enable the TX_DIS, so transmit clock can be enabled.

    Please refer chapter 6 of the TRM for Padconfig register modules.

    Let me know if this helps.

    Also have you tried to play with the clock tree tool to design your system to see how you can have the HFOSC_CLK (25MHz) on AUDIO_EXT_REFCLK1?

    Best Regards

    Suren