Jump to content
43oh

Stellaris default clock is rong on Energia?


Recommended Posts

Well i've been training a bit with CCS with the stellarpad.

Since i'm a beginer in it i was trying codes in Energia and little by little adapting them to stellaris ware C.

 

And sometigh weird has apeared while using  SysCtlDelay().

While trying to figure it out what was the math to know the time i made some test with the stopwatch.

I was using  tempo = 80000000/3; to set 1 second. Problem is it made a 2 second delay. After searching a bit i tried adding:

SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); at the end of the setup.
This now worked.
 
Someone with more experice could check if this is true and stellaris is actualy running at 40Mhz with energia?
Link to post
Share on other sites

Hi,

In Energia the clock is set to 80MHz in wiring.c file, exactly as you did.

 

Calin

 

But try this, the delay should be of 1 second but it actualy is 2seconds.

#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"

double tempo=0;

void setup()
{
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
}

void loop()
{

        GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1, GPIO_PIN_1);
        tempo=(80000000/3);
        ROM_SysCtlDelay(tempo);

        GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1,GPIO_PIN_0);
        tempo=(80000000/3);
        ROM_SysCtlDelay(tempo);
}


EDIT:

It's weird now it seems ok :/

But i made like 5 tests and it was 2sec

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