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.

Tivaware SysCtlClockFreqSet

Hi ,

I need clarification on the function SysctlClockFreqSet, It isn`t unusual to see something like that:

SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 20000000);

if you read the doc, there is 2 argument needed, I don t get why you do a "or" operator on argument like SYSCTL_XTAL_25MHZ. Do it mean set the clock by that or that or that ?

Secondly, what is the difference between, the oscillator and the system clock? What is the difference between a osc and a PLL? and what is PLL VCO?

  • hi,

    Mathieu L. said:
    Do it mean set the clock by that or that or that ?

    No; what you see (|) is bit-OR and not logical OR (as (a || b) - this one is "that or that").

    Each macro in the first parameter is some bit-field for writing into a big 32-bit register. Instead to write 0x45bcaf or something meaningless at first sight, we use those macros to read and know what we have done. You can find out all these macros in driverlib/sysctl.h file. It is wise to read almost all these files as you use them.

    System clock is the one which operates the cpu core. It is derived from various sources, like external crystal or internal oscillators, of lower frequency and transformed to a high frequency with a phased-locked loop. Read the user manual for various sources for system clock and google for PLL concept.

  • Hi i checked the systck.h . But what is the result of doing that bitwise operator? What is the meaning of the result? Also, I don't get why you give more than 1 parameter of the clock for the init function. Because in the datasheet the function is like that:

    SysCtlClockFreqSet(param 1 , param2)
  • Hello Mathieu

    What Petrei has mentioned is correct. First do the operation (OR) of the conditions. The check the same using the sysctl.c prototype of the function as to where the conditions are used and how they affect the register configuration.

    Regards
    Amit