2
\$\begingroup\$

I've just started working with the Stellaris LM3S9B92 (Cortex M3). I have some problems understanding the SysCtlClockSet() function. On the Driverlib page 350 they say that:

The use of the PLL is chosen with either SYSCTL_USE_PLL or SYSCTL_USE_OSC.

and after that, to use an external source I should use:

SYSCTL_USE_OSC | SYSCTL_OSC_MAIN. and for the PLL use SYSCTL_USE_PLL | SYSCTL_OSC_MAIN,

My question is, what's the difference between SYSCTL_USE_OSC and SYSCTL_USE_PLL? I found this example on the net, and the person is using both an external clock source and the PLL! What is considered as a clock source and what is ignored?

SysCtlClockSet(SYSCTL_SYSDIV_2|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
\$\endgroup\$
4
  • \$\begingroup\$ Engine: Stellaris is a depercated Cortex M3 family. It has no more support from TI. Instead, TI has moved to market TIVA which is similar but has fixes for a variety of issues. For example, your flash may only write 100 times, so debugging will fail. Its best you pick a good platform to start. \$\endgroup\$ – Gustavo Litovsky Dec 28 '13 at 14:18
  • \$\begingroup\$ @GustavoLitovsky thanks for your comment, I know TIVA it with the cortex M4, but I'm working on an university project I can't choose which board I get to use ! :( \$\endgroup\$ – Engine Dec 28 '13 at 14:28
  • \$\begingroup\$ Yes, the Stellaris line is deprecated but I don't think TI has introduced other Cortex-M3 processors. Last time I looked they were only building Cortex-M4 parts. \$\endgroup\$ – Joe Hass Dec 28 '13 at 14:56
  • \$\begingroup\$ @JoeHass: That's true but going to Cortex-M4 is quite easy since its an extension of Cortex-M3 in many ways. But, given that OP can't choose, I guess the issue is moot. \$\endgroup\$ – Gustavo Litovsky Dec 28 '13 at 19:54
2
\$\begingroup\$

I'm not going to take the time to study an obsolete microcontroller but I will speculate based on my knowledge of NXP's Cortex-M3 processors.

The microcontroller has a crystal oscillator that can operate at some reasonable frequency, say 12MHz. The microcontroller also has an internal oscillator that is not as accurate as a crystal oscillator but uses an RC time constant to set the frequency. The processor core can actually run much faster than either of these oscillators, say 72MHz, so the chip provides a PLL that can be used to synthesize a higher frequency clock.

When configuring the microcontroller you can decide which of the oscillators you want to use: the crystal oscillator or the less accurate RC oscillator. I'm guessing that the SYSCTL_OSC_MAIN configuration bit performs that selection.

You can also decide whether to operate the processor directly from the selected oscillator or use the PLL to increase the frequency. My guess is that SYSCTL_USE_PLL selects the PLL as the system clock source. If you do use the PLL then there may be other parameters that are needed, such as indicating the approximate value of the oscillator frequency with SYSCTL_XTAL_16MHZ.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.