Skip to main content
ivancolla9
Associate III
February 8, 2016
Question

System clock configuration

  • February 8, 2016
  • 2 replies
  • 1343 views
Posted on February 08, 2016 at 13:18

Good morning.

I have a problem setting the system clock of SPC560EL. I want to use the internal clock, but I cannot. Each time I execute the code, reading the main status register, I see that the SYSCLOCK switch to PPL. I cannot understand why this is the case.

In the wizard, the external oscillator bypass is not checked. Is this the correct behaviour?

Someone could be so kind to explain me how to configure the micro via wizard so that i don't use external oscillators? The board on which the micro is mounted doesn't have one.

Thank you,

Ivan

#clock-generation-internal
    This topic has been closed for replies.

    2 replies

    Erwan YVIN
    ST Employee
    February 23, 2016
    Posted on February 23, 2016 at 16:39 Hello Ivan , You are in RUN0 mode in RUN0 mode , SYSCLK is set on PLL0

    /**
    * @brief RUN0 mode settings.
    */
    #if !defined(SPC5_ME_RUN0_MC_BITS) || defined(__DOXYGEN__)
    #define SPC5_ME_RUN0_MC_BITS (SPC5_ME_MC_SYSCLK_FMPLL0 | \
    SPC5_ME_MC_IRCON | \
    SPC5_ME_MC_XOSC0ON | \
    SPC5_ME_MC_PLL0ON | \
    SPC5_ME_MC_PLL1ON | \
    SPC5_ME_MC_FLAON_NORMAL | \
    SPC5_ME_MC_MVRON)
    #endif

    if you want to use IRC ,

    /**
    * @brief RUN0 mode settings.
    */
    #if !defined(SPC5_ME_RUN0_MC_BITS) || defined(__DOXYGEN__)
    #define SPC5_ME_RUN0_MC_BITS (SPC5_ME_MC_SYSCLK_IRC | \
    SPC5_ME_MC_IRCON | \
    SPC5_ME_MC_XOSC0ON | \
    SPC5_ME_MC_PLL0ON | \
    SPC5_ME_MC_PLL1ON | \
    SPC5_ME_MC_FLAON_NORMAL | \
    SPC5_ME_MC_MVRON)
    #endif

    in the wizard, the oscillator bypass is checked and set this register :

    #if defined(SPC5_OSC_BYPASS)
    /* If the board is equipped with an oscillator instead of a crystal then the
    bypass must be activated.*/
    CGM.OSC_CTL.B.OSCBYP = TRUE;
    #endif /* SPC5_OSC_BYPASS */

    if you use internal clock .. do not enable Oscillator bypass. Best regards Erwan
    ivancolla9
    Associate III
    February 29, 2016
    Posted on February 29, 2016 at 15:45

    Hello Erwan,

    thank you for the reply. Following your exmple I managed to chang the clock and use internal oscillator. 

    Regards,

    Ivan