L.R.A 78 Posted October 3, 2013 Share Posted October 3, 2013 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? Quote Link to post Share on other sites
calinp 24 Posted October 3, 2013 Share Posted October 3, 2013 Hi, In Energia the clock is set to 80MHz in wiring.c file, exactly as you did. Calin Quote Link to post Share on other sites
L.R.A 78 Posted October 3, 2013 Author Share Posted October 3, 2013 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 energia 1 Quote Link to post Share on other sites
L.R.A 78 Posted October 5, 2013 Author Share Posted October 5, 2013 Well this is weird. Gona have to test more. Now every test seems alright. But while in the club it hapened again. Tough i was using it inside a interrupt and even with the clock set command in it 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.