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.

AM2631: PLL and clkout pin configuration using SysCfg

Part Number: AM2631


Hello,

Is it possible to configure the PLL, and the clkout pins, using SysCfg? I don't see it using SysCfg 1.17.0.3128 nor found the gel file (for this uC) described in 

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1172793/am2634-am263x-peripheral-clock-configuration-using-sysconfig

If not, any SDK/sample code that I can take a look at?

Thanks,

Javier.

  • Hello Javier,

    The gel file containing the functions for configuring the PLL mentioned in the previous post can be found at:

    "C:\ti\ccs12##\ccs\ccs_base\emulation\gel\AM263x\AM263_PLL\*"

    or

    "<CCS_INSTALL_PATH>\ccs12##\ccs\ccs_base\emulation\gel\AM263x\AM263_PLL\*"

    depending on where you saved code composer studio on your local machine during install.

    I did not find a clear CLKOUTx example so I will file a bug to make sure that is added to the SDK and will work on a short test example in the mean-time.

    Best Regards,

    Zackary Fleenor

  • Hey Javier,

    I am including some example gel code that could be used as a starting point.

    Save this source code in a new AM263_CLKOUT_CFG.gel file the GEL directory mentioned in the response above and add the following line with the other gel file calls in the main AM263x.gel file: GEL_LoadGel( "$(GEL_file_dir)/AM263_PLL/AM263_CLKOUT_CFG.gel");

    /**
     * \file  AM263_CLKOUT_CONFIG.gel
     *
     * \brief GEL File to configure CLKOUT0 for AM263x
     */
    
    /* Copyright (c) 2024, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
    
    /* Revision history:
     * 02-15-2024 - Initial Creation
     */
    
    // Register Definitions and Offsets
    #define IOMUX_U_BASE											(0x53100000U)
    #define IOMUX_IO_CFG_KICK0										(0x00000298U)
    #define IOMUX_IO_CFG_KICK1								 		(0x0000029CU)
    #define IOMUX_CLKOUT0_CFG_REG									(0x00000228U)
    #define IOMUX_SDFM0_CLK0_CFG_REG								(0x000001E8U)
    
    #define MSS_TOP_RCM_U_BASE										(0x53200000U)
    #define MSS_TOP_RCM_LOCK0_KICK0									(0x00001008U)
    #define MSS_TOP_RCM_LOCK0_KICK1									(0x0000100CU)
    
    #define MSS_TOP_RCM_CLKOUT0_CLK_SRC_SEL							(0x00000C00U)
    #define MSS_TOP_RCM_CLKOUT1_CLK_SRC_SEL							(0x00000C04U)
    #define MSS_TOP_RCM_CLKOUT0_DIV_VAL								(0x00000C08U)
    #define MSS_TOP_RCM_CLKOUT1_DIV_VAL								(0x00000C0CU)
    #define MSS_TOP_RCM_CLKOUT0_CLK_GATE							(0x00000C10U)
    #define MSS_TOP_RCM_CLKOUT1_CLK_GATE							(0x00000C14U)
    #define MSS_TOP_RCM_CLKOUT0_CLK_STATUS							(0x00000C18U)
    #define MSS_TOP_RCM_CLKOUT1_CLK_STATUS							(0x00000C1CU)
    
    #define XTALCLK													(0x000)
    #define DPLL_CORE_HSDIV_CLKOUT0									(0x111)
    #define DPLL_CORE_HSDIV_CLKOUT1									(0x222)
    #define DPLL_PER_HSDIV_CLKOUT0									(0x333)
    #define DPLL_PER_HSDIV_CLKOUT1									(0x444)
    #define RCCLK10M												(0x555)
    #define RCCLK32K												(0x666)
    #define CPTS_GENF0												(0x777)
    
    #define div1													(0x000)
    #define div2													(0x111)
    #define div3													(0x222)
    #define div4													(0x333)
    #define div5													(0x444)
    #define div6													(0x555)
    #define div7													(0x666)
    #define div8													(0x777)
    #define div9													(0x888)
    #define div10													(0x999)
    #define div11													(0xAAA)
    #define div12													(0xBBB)
    #define div13													(0xCCC)
    #define div14													(0xDDD)
    #define div15													(0xEEE)
    #define div16													(0xFFF)
    
    
    hotmenu Make_CLKOUT0_25MHz_XTALCLK_div1() 
    {
    	MSS_TOPRCM_unlock();
    
    	// Use CLK Source defines as the input source clock for CLKOUT0
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_CLK_SRC_SEL, XTALCLK);
    	GEL_TextOut("XTALCLK selected as CLK source for CLKOUT0\n");
    	
    	// Write DIV_VAL as the clock divider value for CLKOUT0
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_DIV_VAL, div1);
    	GEL_TextOut("XTALCLK will be divided by 0 for 25MHz CLKOUT0\n");
    }
    
    
    hotmenu Make_CLKOUT0_10MHz_RCCLK10M_div1() 
    {
    	MSS_TOPRCM_unlock();
    
    	// Use CLK Source defines as the input source clock for CLKOUT0
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_CLK_SRC_SEL, RCCLK10M);
    	GEL_TextOut("RCCLK10M selected as CLK source for CLKOUT0\n");
    	
    	// Write DIV_VAL as the clock divider value for CLKOUT0
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_DIV_VAL, div1);
    	GEL_TextOut("RCCLK10M will be divided by 1 for 10MHz CLKOUT0\n");
    }
    
    
    hotmenu Make_CLKOUT0_5MHz_RCCLK10M_div2() 
    {
    	MSS_TOPRCM_unlock();
    
    	// Use CLK Source defines as the input source clock for CLKOUT0
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_CLK_SRC_SEL, RCCLK10M);
    	GEL_TextOut("RCCLK10M selected as CLK source for CLKOUT0\n");
    	
    	// Write DIV_VAL as the clock divider value for CLKOUT0
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_DIV_VAL, div1);
    	GEL_TextOut("RCCLK10M will be divided by 2 for 5MHz CLKOUT0\n");
    }
    
    
    hotmenu Make_CLKOUT0_2MHz_RCCLK10M_div5() 
    {
    	MSS_TOPRCM_unlock();
    
    	// Use CLK Source defines as the input source clock for CLKOUT0
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_CLK_SRC_SEL, RCCLK10M);
    	GEL_TextOut("RCCLK10M selected as CLK source for CLKOUT0\n");
    	
    	// Write DIV_VAL as the clock divider value for CLKOUT0
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_DIV_VAL, div5);
    	GEL_TextOut("RCCLK10M will be divided by 5 for 2MHz CLKOUT0\n");
    }
    
    
    hotmenu Make_CLKOUT0_32kHz_RCCLK32_div1() 
    {
    	MSS_TOPRCM_unlock();
    
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_CLK_SRC_SEL, RCCLK32K);
    	GEL_TextOut("RCCLK32K selected as CLK source for CLKOUT0\n");
    	
    	// Write DIV_VAL as the clock divider value for CLKOUT0
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_DIV_VAL, div1);
    	GEL_TextOut("RCCLK32K will be divided by 1 for 32kHz CLKOUT0\n");
    }
    
    
    hotmenu Make_CLKOUT0_16kHz_RCCLK32K_div2() 
    {
    	MSS_TOPRCM_unlock();
    
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_CLK_SRC_SEL, RCCLK10M);
    	GEL_TextOut("RCCLK32K selected as CLK source for CLKOUT0\n");
    	
    	// Write DIV_VAL as the clock divider value for CLKOUT0
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_DIV_VAL, div2);
    	GEL_TextOut("RCCLK32K will be divided by 2 for 16kHz CLKOUT0\n");
    }
    
    
    hotmenu Make_CLKOUT0_8kHz_RCCLK32K_div4() 
    {
    	MSS_TOPRCM_unlock();
    
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_CLK_SRC_SEL, RCCLK32K);
    	GEL_TextOut("RCCLK32K selected as CLK source for CLKOUT0 \n");
    	
    	// Write DIV_VAL as the clock divider value for CLKOUT0
    	Write_MMR(MSS_TOP_RCM_U_BASE+ MSS_TOP_RCM_CLKOUT0_DIV_VAL, div4);
    	GEL_TextOut("RCCLK32K will be divided by 4 for 8kHz CLKOUT0\n");
    }

    Hope this helps!

    Best Regards,

    Zackary Fleenor

  • Thanks Zachary, I will give it a try, appreciate the prompt response. I had not realized that the GEL file is by default not part of the project, but of the common files. I also saw that the GEL file can be customized if the initialization script location is modified (Target Configuration -> Cpu Properties -> initialization script).

    Best regards,

    Javier

  • Just to confirm Zachary, that it worked for me. The only thing is that I had to disable SysCfg to manually change the PIN_MODE of the CLKOUT1 pin. This link has the instructions to disable SysCfg: 

    https://software-dl.ti.com/simplelink/esd/simplelink_cc13x2_26x2_sdk/3.40.00.02/exports/docs/ti154stack/html/sysconfig/sysconfig-disable.html

    Thanks,

    Javier