Jump to content
Simao

I can´t undertand SysCtlClockGet() behaviour

Recommended Posts

     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.

Share this post


Link to post
Share on other sites

@@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.

Share this post


Link to post
Share on other sites

     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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...