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.

How is the system clock frequency set?



Hello all,

I read (in a tutorial from T.I.) that the following live sets the system clock to 40MHz:

SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);

Why is this? Shouldn't it be set at 16/5 = 3.2 MHz ??

  • Hello Dimitrois,

    The function is using the PLL and not the oscillator. Hence the value is not 16/5 but 200/5=40 (since the PLL is using the crystal to lock to a higher frequency which can be used to generate other system clock values)

    Regards
    Amit
  • Hi Amit,

    My firm doesn't use these parts often enough anymore for me to know - is not, "SYSCTL_SYSDIV_5" sufficiently vague - as to justify poster's question?    I cannot recall if - when using just external xtal or xtal osc - that - "SYSCTL_SYSDIV_5" is (then) legal.

    Appears that, "SYSCTL_SYSDIV_PLL_5" would prove superior in that "actual identification of the system clock source" is defined.

    Yes you (for sure) and long-time users (even moi) "know & often employ the PLL" - thus we succeed thru past use familiarity.   But not thru any real clarity conveyed by the source parameter's (ambiguous) wordage!    And how can SYSCTL (possibly) trump PLL - w/in that parameter - that's not justifiable!

    Insider info & user familiarity should not trump, "clarity of expression!"

  • I agree with that macro update, since the division does not apply to the system clock, but to the PLL that after that division becomes the system clock (if chosen to be used).

    To know more about the clock system on the TM4C check "5.2.5 Clock Control" on your datasheet. I find the Figure 5-5. Main Clock Tree most useful as well the rest of info on that section
  • Thanks Luis - poster's logic was without fault (that I could note) - I chose to, "point out the obvious."

    Too often - experience & "insider knowledge" take the place of proper, well-thought & defined - explanation.  That's not, "How things should be!"

    My suggestion of a tighter (i.e. "some") linking of "What's being divided" appears a valid improvement. (and will be "noted" - perhaps "duly" yet I'd not "hold my breath" awaiting implementation.)

  • You can read this manual on the peripheral API functions for the Tivaware that I've found very informative : www0.egr.uh.edu/.../spmu298a_TivaWare_Peripheral_Driver_Lib.pdf
    Check the section on system control - it has a list of all the associated API functions and the possible arguments.