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.

Systick Clock Source

I am using CCS5 Version: 5.4.0.00091.  I am using a EK-LM4F120XL launchpad with a LM4F120H5QR processor.  I have written a program using systick commands and the program works great.  It uses the system clock because bit 2 of the NVIC_ST_CTRL_R is set.  I have the following commands which alter Systick interupt and Systick enable or disable.  What is the command to change the clock source bit from a 1 to a 0. 

SysTickIntDisable(); //Not using Systick interupt so turn it off.
SysTickEnable(); //Enable Systick

I am 64 and live in south Texas so any responses should be written slowly and very loud.

  • Donald Varela said:
     What is the command to change the clock source bit from a 1 to a 0. 

    Don't know that we've ever thought of that.  (and doubt StellarisWare developers did - either)

    Suspect that you may want to clock SysTick from the internal osc - and if that is possible - review of System Control Registers may reveal a linkage. 

    Use care in so doing (i.e. "|= or &=" into critical registers - so as not to cause unwanted consequence.)   Mistake there may wreak havoc.

    (touch typed this response w/2 fingers - and cranked speaker beyond Class "D" - then launched pigeon w/Galveston or bust banner...)

  • I used NVIC_ST_CTRL_R |=0x00000001; which just set the enable bit and it worked.  I hate working directly with the registers because of  the term havoc  which is controlled by Murphy's law.

    Along this line do you know how to read the frequency of the PIOSC?  To get the system clock you use SysCtlClockGet().

  • To generate a scaled frequency of the System Clock - and output it - we employ a Timer config'ed in PWM mode.  Early versions of PIOSC were not quite, "Good for Gov't work" thus we avoided...  If the MCU Timers will accept PIOSC as clock source - that is one way to satisfy your frequency measurement.  (and produce a usable signal - as well)

    Wonder if - in switching over to PIOSC - its value would thus be returned via that same, "SysCtlClockGet()" command?  

  • No SysCtlClockGet() returns the sytem clock which I have running at 50MHZ.  I know that when you set bit 2 to "0"  it uses the PIOSC divided by 4.  I know the PIOSC clock is around 16MHZ, but to accurately calculate the frequency I would like to  get the actual frequency.

  • Donald Varela said:
    PIOSC clock is around 16MHZ, I'd like to  get the actual frequency.

    Again - if the MCU Timers will accept PIOSC as their input clock - you can cause that clock signal to be output on a timer pin. 

  • I think for what I,m doing I will assume it is 16 MHZ.  I need the data to calculate the ms pulse length, (1/clkfreq)/4*Period.  So I think my problem has been answered, there isn't a function to get PIOSC frequency.  Had to write my own function to set either system clock or PIOSC as Systick clock source.