Problem with defining external 32K oscillator as FLL source

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with defining external 32K oscillator as FLL source

Jump to solution
2,983 Views
MichaelDavid
Contributor III

I have a problem with configuring 32K as clock soure.. Attached is the configuration code.

    MCG_C2 = 0;        //new        MCG_C2 = MCG_C2_HGO_MASK | MCG_C2_EREFS_MASK;        //new    MCG_C1 = 0;        //new    /* Wait for crystal to initialize */    while (!(MCG_S & MCG_S_OSCINIT_MASK)) {};        /* Wait for Reference Clock Status bit to clear */    while (MCG_S & MCG_S_IREFST_MASK) {};        /* Wait for clock status bits to show clock source      * is external reference clock */    //while (((MCG_S & MCG_S_CLKST_MASK) >> MCG_S_CLKST_SHIFT) != 0x2) {};    //new    while (((MCG_S & MCG_S_CLKST_MASK) >> MCG_S_CLKST_SHIFT) != 0x0) {};        //new FEE    MCG_C4 |= MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS(3);    /* Now in FBE     * Configure PLL Reference Divider, PLLCLKEN = 0, PLLSTEN = 0, PRDIV = 0x18     * The crystal frequency is used to select the PRDIV value.      * Only even frequency crystals are supported     * that will produce a 2MHz reference clock to the PLL.     */    //MCG_C5 = MCG_C5_PRDIV(BSP_REF_CLOCK_DIV - 1);    /* Ensure MCG_C6 is at the reset default of 0. LOLIE disabled,      * PLL disabled, clock monitor disabled, PLL VCO divider is clear     */    MCG_C6 = 0;        /* Calculate mask for System Clock Divider Register 1 SIM_CLKDIV1 */    SIM_CLKDIV1_COPY =  SIM_CLKDIV1_OUTDIV1(BSP_CORE_DIV    - 1) |                        SIM_CLKDIV1_OUTDIV2(BSP_BUS_DIV     - 1) |                        SIM_CLKDIV1_OUTDIV3(BSP_FLEXBUS_DIV - 1) |                        SIM_CLKDIV1_OUTDIV4(BSP_FLASH_DIV   - 1);       

 

0 Kudos
Reply
1 Solution
2,593 Views
tr9
Contributor II

In the SIM module there is a register; SIM_SOPT2 that contains the field; MCGCLKSEL that allows you to map the RTS oscillator (EXTAL32 and XTAL32 inputs) to the FLL. You set this field = 1.

 

From there you can use FEE mode to generate higher clock rates out of the FLL.

View solution in original post

0 Kudos
Reply
5 Replies
75 Views
HANDE2910
Contributor I

Feeling lonely? Break the silence and connect with the world instantly! Try Omegle chat to meet new, interesting people from across the globe and spark spontaneous conversations anytime.

0 Kudos
Reply
76 Views
HANDE2910
Contributor I
Feeling lonely? Break the silence and connect with the world instantly! Try Omegle chat to meet new, interesting people from across the globe and spark spontaneous conversations anytime. https://omeglechat.love/
0 Kudos
Reply
2,593 Views
tr9
Contributor II

1. Is your external 32 K oscillator connected to EXTAL  or  EXTAL32 / XTAL32 (the RTC oscillator) ?

2,593 Views
MichaelDavid
Contributor III

That was the fault. can I configure the RTC clock as the system clock?

0 Kudos
Reply
2,593 Views
tr9
Contributor II

In the SIM module there is a register; SIM_SOPT2 that contains the field; MCGCLKSEL that allows you to map the RTS oscillator (EXTAL32 and XTAL32 inputs) to the FLL. You set this field = 1.

 

From there you can use FEE mode to generate higher clock rates out of the FLL.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-187535%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EProblem%20with%20defining%20external%2032K%20oscillator%20as%20FLL%20source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-187535%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20have%20a%20problem%20with%20configuring%2032K%20as%20clock%20soure..%20Attached%20is%20the%20configuration%20code.%3C%2FP%3E%3CPRE%3E%20%20%20%20MCG_C2%20%3D%200%3B%20%20%20%20%20%20%20%20%2F%2Fnew%20%20%20%20%20%20%20%20MCG_C2%20%3D%20MCG_C2_HGO_MASK%20%7C%20MCG_C2_EREFS_MASK%3B%20%20%20%20%20%20%20%20%2F%2Fnew%20%20%20%20MCG_C1%20%3D%200%3B%20%20%20%20%20%20%20%20%2F%2Fnew%20%20%20%20%2F*%20Wait%20for%20crystal%20to%20initialize%20*%2F%20%20%20%20while%20(!(MCG_S%20%26amp%3B%20MCG_S_OSCINIT_MASK))%20%7B%7D%3B%20%20%20%20%20%20%20%20%2F*%20Wait%20for%20Reference%20Clock%20Status%20bit%20to%20clear%20*%2F%20%20%20%20while%20(MCG_S%20%26amp%3B%20MCG_S_IREFST_MASK)%20%7B%7D%3B%20%20%20%20%20%20%20%20%2F*%20Wait%20for%20clock%20status%20bits%20to%20show%20clock%20source%20%20%20%20%20%20*%20is%20external%20reference%20clock%20*%2F%20%20%20%20%2F%2Fwhile%20(((MCG_S%20%26amp%3B%20MCG_S_CLKST_MASK)%20%26gt%3B%26gt%3B%20MCG_S_CLKST_SHIFT)%20!%3D%200x2)%20%7B%7D%3B%20%20%20%20%2F%2Fnew%20%20%20%20while%20(((MCG_S%20%26amp%3B%20MCG_S_CLKST_MASK)%20%26gt%3B%26gt%3B%20MCG_S_CLKST_SHIFT)%20!%3D%200x0)%20%7B%7D%3B%20%20%20%20%20%20%20%20%2F%2Fnew%20FEE%20%20%20%20MCG_C4%20%7C%3D%20MCG_C4_DMX32_MASK%20%7C%20MCG_C4_DRST_DRS(3)%3B%20%20%20%20%2F*%20Now%20in%20FBE%20%20%20%20%20*%20Configure%20PLL%20Reference%20Divider%2C%20PLLCLKEN%20%3D%200%2C%20PLLSTEN%20%3D%200%2C%20PRDIV%20%3D%200x18%20%20%20%20%20*%20The%20crystal%20frequency%20is%20used%20to%20select%20the%20PRDIV%20value.%20%20%20%20%20%20*%20Only%20even%20frequency%20crystals%20are%20supported%20%20%20%20%20*%20that%20will%20produce%20a%202MHz%20reference%20clock%20to%20the%20PLL.%20%20%20%20%20*%2F%20%20%20%20%2F%2FMCG_C5%20%3D%20MCG_C5_PRDIV(BSP_REF_CLOCK_DIV%20-%201)%3B%20%20%20%20%2F*%20Ensure%20MCG_C6%20is%20at%20the%20reset%20default%20of%200.%20LOLIE%20disabled%2C%20%20%20%20%20%20*%20PLL%20disabled%2C%20clock%20monitor%20disabled%2C%20PLL%20VCO%20divider%20is%20clear%20%20%20%20%20*%2F%20%20%20%20MCG_C6%20%3D%200%3B%20%20%20%20%20%20%20%20%2F*%20Calculate%20mask%20for%20System%20Clock%20Divider%20Register%201%20SIM_CLKDIV1%20*%2F%20%20%20%20SIM_CLKDIV1_COPY%20%3D%20%20SIM_CLKDIV1_OUTDIV1(BSP_CORE_DIV%20%20%20%20-%201)%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20SIM_CLKDIV1_OUTDIV2(BSP_BUS_DIV%20%20%20%20%20-%201)%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20SIM_CLKDIV1_OUTDIV3(BSP_FLEXBUS_DIV%20-%201)%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20SIM_CLKDIV1_OUTDIV4(BSP_FLASH_DIV%20%20%20-%201)%3B%20%20%20%20%20%20%20%3C%2FPRE%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2425725%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Problem%20with%20defining%20external%2032K%20oscillator%20as%20FLL%20source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2425725%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EFeeling%20lonely%3F%20Break%20the%20silence%20and%20connect%20with%20the%20world%20instantly!%20Try%20%3CA%20title%3D%22omegle%22%20href%3D%22https%3A%2F%2Fomeglechat.love%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EOmegle%20chat%3C%2FA%3E%20to%20meet%20new%2C%20interesting%20people%20from%20across%20the%20globe%20and%20spark%20spontaneous%20conversations%20anytime.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2425723%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Problem%20with%20defining%20external%2032K%20oscillator%20as%20FLL%20source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2425723%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EFeeling%20lonely%3F%20Break%20the%20silence%20and%20connect%20with%20the%20world%20instantly!%20Try%20Omegle%20chat%20to%20meet%20new%2C%20interesting%20people%20from%20across%20the%20globe%20and%20spark%20spontaneous%20conversations%20anytime.%20%3CA%20href%3D%22https%3A%2F%2Fomeglechat.love%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fomeglechat.love%2F%3C%2FA%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-187538%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Problem%20with%20defining%20external%2032K%20oscillator%20as%20FLL%20source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-187538%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EIn%20the%20SIM%20module%20there%20is%20a%20register%3B%20SIM_SOPT2%20that%20contains%20the%20field%3B%20MCGCLKSEL%20that%20allows%20you%20to%20map%20the%20RTS%20oscillator%20(EXTAL32%20and%20XTAL32%20inputs)%20to%20the%20FLL.%20You%20set%20this%20field%20%3D%201.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EFrom%20there%20you%20can%20use%20FEE%20mode%20to%20generate%20higher%20clock%20rates%20out%20of%20the%20FLL.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-187537%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Problem%20with%20defining%20external%2032K%20oscillator%20as%20FLL%20source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-187537%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThat%20was%20the%20fault.%20can%20I%20configure%20the%20RTC%20clock%20as%20the%20system%20clock%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-187536%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Problem%20with%20defining%20external%2032K%20oscillator%20as%20FLL%20source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-187536%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E1.%20Is%20your%20external%2032%20K%20oscillator%20connected%20to%20EXTAL%26nbsp%3B%20or%20%26nbsp%3BEXTAL32%20%2F%20XTAL32%20(the%20RTC%20oscillator)%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E