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.

SysCtlClockSet() documentation

Hi,

I have been developing on a LM4F Launchpad and I am now adapting my code to run on my custom target board.

We have a 25Mhz clock and I believe I can set up the TM4C123 to use this using the ROM_SysCtlClockSet(value), but I can't find the documentation to tell me exactly how to do this. Both the DriverLib and ROM User Guides show possible values but not how to choose them.

Thanks

Richard

  • Hi Richard,

        Check your device datasheet regarding system clock. Also, you can check how SysCtlClockSet() is used from the example programs in Tivaware.

    -kel

  • OK Thanks.

    Would be nice to see it all written out rather than having to deduce it I think.

    Richard

  • Might you mean - like this?

        // Configure the processor to run at 50 MHz.
        //
        SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_25MHZ |
                           SYSCTL_OSC_MAIN);

    Ours is 25MHz external xtal - desired SysClock @ 50MHz.  (as PLL effectively runs @ 200MHz - divided by 4 as above.  Dividing by different values yields multiple Sys Clock frequencies - but you must stay w/in data-sheet ranges...)

    (Verify Answer (click on your responder's post) is more normal/customary...i.e. little verification w/in your post - above...)

  • Is 50MHz the recommended clocking frequency - it says 80MHz on the summary in the data sheet.

    I don't understand what you mean by "little vericfication" I'm afraid!

  • There really is no "recommended" System Clock frequency.  Max is 80MHz as you note - I detailed 50MHz as it eased (and well illustrated) the "PLL divide by 4" method w/in that function.

    MCU's desired execution speed, power consumption, and the timing requirements of connected peripheral devices all enter into this frequency determination...

    In the past - the ROM based functions had difficulty in achieving "fractional PLL divides" - required to reach 80MHz.  That speed was achieved via calls to the flash-based versions of that System function.

    Verification is normally awarded to those posts which "answered" your issue/concerns.  You've found the mechanism to do so - but clicked your own post (which carried little verification) rather than a more descriptive, answering post - which would prove far more useful to follow-on visitors to this posting...

  • Thanks for the clarifications on the clocks.

    I'm still not clear about Verify/Suggest/Yes buttons, in what way does it affect follow-on visitors? I find searching on the forum very tedious as each thread comes up multiple times so I tend to give up and post my own question. Am I using it wrongly?

  • No forum is perfect - but vendor's here/near clearly, "best in class."

    Much of the search difficulty you note is caused by the imprecise/effort-minimal subject listings by posters.  (yours was quite good)  Often a slight change of keyword w/in "search" will reveal "new ground."  Indeed there is repetition - keeping "notepad/similar" open during the search - enables copy/paste logging of the post name/dates you've reviewed - thus speeds/eases by reducing unwanted duplication.  (i.e. re-reads)

    Verify - with its green highlight - enables follow-on readers to quickly find that post(s) (w/in a multi-post thread) which contain the "paydirt."   In your case - you've "verified" your post - not the ones which contained key answers/guides - which solved your issue.  You should more properly click verify of those posts which answer - rather than list the question/issue du jour...  (one notes that you've followed this incorrect verification procedure (verifying your question - never the responders "correct response")  across several of your recent posts...)  If still unclear - visit other posts - you will note that correct responder posts are customarily verified - not those of the originating (questioning) poster...

    Update: yes - multiple answering posts - if correct - may be so awarded (my fair belief - although like you I am outsider/user/specifier...)  (forum history - dating to 2007 - does confirm...)

  • Ah - many thanks - I hadn't realised - can a thread have more then one verified answer post?

    Agreed this forum is really excellent form of support - adds big value.

  • Well I just answered my own question by taking the time to play a bit.

    Sorreeee!

  • One final beat of this dead/dying horse...

    Always double/triple check that the xtal parameter w/in:

    SysCtlClockSet()     i.e. SYSCTL_XTAL_25MHZ  matches the xtal on your board!  A mismatch here will land you most always w/in dreaded JTAG "lock-out."   While recovery is possible - far better to prevent rather than restore...

    This misfortune is most likely when you "borrow/steal/import" code from some board, MCU, source - which employs a crystal different from that resident - your board.  Beware ...