Run RT1010 with internal clocks only?

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

Run RT1010 with internal clocks only?

3,794 Views
Elmi77
Contributor III

Hi,

I'm currently working with the LED-blink-example and the RT1010 evaluation board. I'm trying to run this code with as less external equipment as possible. For this, as a first step, I have configured the 32,768 kHz RTC oscillator as "Internal Oscillator". This works fine, but when I try the same with the 24 MHz clock source, my application dies during start-up:

Clipboard01.png

So switching "OSC mode" to "Internal RC oscillator" does not do the job. What else has to be done to run the MCU with internal clock and completely without any external oscillators?

Thanks!

 

0 Kudos
Reply
4 Replies

3,783 Views
jay_heng
NXP Employee
NXP Employee

I tried to modify clock configuration as below, application(\demo_apps\led_blinky) can still run properly

 

 

void BOARD_BootClockRUN(void)
{
    /* Init RTC OSC clock frequency. */
    CLOCK_SetRtcXtalFreq(32768U);
    /* Enable 1MHz clock output. */
    //XTALOSC24M->OSC_CONFIG2 |= XTALOSC24M_OSC_CONFIG2_ENABLE_1M_MASK;
    /* Use free 1MHz clock output. */
    //XTALOSC24M->OSC_CONFIG2 &= ~XTALOSC24M_OSC_CONFIG2_MUX_1M_MASK;
    /* Set XTAL 24MHz clock frequency. */
    //CLOCK_SetXtalFreq(24000000U);
    /* Enable XTAL 24MHz clock source. */
    //CLOCK_InitExternalClk(0);
    /* Enable internal RC. */
    CLOCK_InitRcOsc24M();
    /* Switch clock source to internal OSC. */
    CLOCK_SwitchOsc(kCLOCK_RcOsc);
    ...
}

 

 

 

0 Kudos
Reply

3,763 Views
Elmi77
Contributor III

Thank you for your feedback.

Unfortunately exactly this code does not work for me.

When I switch to "Internal Oscillator" in "Config Tools" -> "Clocks", it generates a code whic hstill contains the calls to

XTALOSC24M->OSC_CONFIG2 |= XTALOSC24M_OSC_CONFIG2_ENABLE_1M_MASK;
XTALOSC24M->OSC_CONFIG2 &= ~XTALOSC24M_OSC_CONFIG2_MUX_1M_MASK;
CLOCK_SetXtalFreq(24000000U);
CLOCK_InitExternalClk(0);

 

But no matter if I leave them or comment them out as in your code, the application then dies at CLOCK_SwitchOsc(kCLOCK_XtalOsc) - or to be more specific it dies at

XTALOSC24M->LOWPWR_CTRL_SET = XTALOSC24M_LOWPWR_CTRL_SET_OSC_SEL_MASK;

Clipboard01.png

 

3,620 Views
jay_heng
NXP Employee
NXP Employee

Please use attached code, it is verified with SDK 2.11.

You can call switch_to_rc24m() after BOARD_BootClockRUN()

 

3,304 Views
jay_heng
NXP Employee
NXP Employee

By default, ARM core clock is powered by PLL, PLL clock is powered by external 24MHz OSC.

If you want to switch to internal RC 24MHz OSC, you need to follow below steps:

void ClockSelectRcOsc(void)
{
    // Switch ARM core clock source from PLL to OSC24M
    CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 1);
    CLOCK_SetMux(kCLOCK_PeriphMux, 1);

    // Switch OSC24M clock source from external 24MHz OSC to internal RC24M OSC
    CLOCK_InitRcOsc24M();
    CLOCK_SwitchOsc(kCLOCK_RcOsc);
    CLOCK_DeinitExternalClk();

    // Recover ARM core clock source
    CLOCK_SetMux(kCLOCK_PeriphClk2Mux, m);
    CLOCK_SetMux(kCLOCK_PeriphMux, n);
}

 

 

0 Kudos
Reply