Simao 0 Posted August 13, 2013 Share Posted August 13, 2013 Hi there, I would really appreciate any help here. Assuming ClockVal defined as unsigned long Clockval=0 After executing this 2 lines of code... SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); ClockVal = SysCtlClockGet(); What should be the correct value of Clockval? A friend of mine reported 40,000.000 meaning 40 Mhz using IAR, in my case running Keil I get 3,200000 or 3.2 Mhz, does abybody have a clue for this weird value??Thanks a lot in advance Simao P.S. 1) We both use Stellaris LM4F120 LaunchPad Evaluation Kit P.S. 2) It´s my first post so please bear with me if it´s not formaly correct. Quote Link to post Share on other sites
bluehash 1,581 Posted August 13, 2013 Share Posted August 13, 2013 @@Simao Following will set the Stellaris Launchpad at 80Mhz SysCtlClockSet( SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | \ SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); What this means is - You are instructing the PLL to run to 400Mhz using the 16Mhz as input to it. The PLL is then divided by 2 internally in hardware, and then 2.5 400/2/2.5 = 80 SysCtlClockGet() will give you 80000000Hz. SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); ClockVal = SysCtlClockGet(); 400/2/5 = 40Mhz Explained here too. Quote Link to post Share on other sites
Simao 0 Posted August 13, 2013 Author Share Posted August 13, 2013 Thanks a lot for your explanation. I´ll try your tip for 80Mhz and I`ll keep you informed. Simão Quote Link to post Share on other sites
bluehash 1,581 Posted August 13, 2013 Share Posted August 13, 2013 Thanks a lot for your explanation. I´ll try your tip for 80Mhz and I`ll keep you informed. Simão It is kind of confusing, but look up the clock diagram in the datasheet. What plans do you have for it? Quote Link to post Share on other sites
Simao 0 Posted August 13, 2013 Author Share Posted August 13, 2013 Acctually it worked already, my concern is about the value I get when I call SysCtlClockGet(), I guess I have to dig into KEIL help files to know what is happening but freq is OK. Thanks again. Simao Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.