kreitzz 0 Posted August 20, 2018 Share Posted August 20, 2018 Hello! I am currently moving a project from MSP430G2553 MCU to newer MSPFR2433. I have MSP-EXP430FR2433 board and Energia-1.6.10E18 IDE Software. From the beginning I saw very strange thing - big difference in DELAY and SLEEP intervals, but only on MSP-EXP430FR2433 board. For example, even simplest elementary code for BLINK run on MSP-EXP430FR2433: #define LED RED_LED void setup() { pinMode(LED, OUTPUT); }void loop() {digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)sleep(4000); // wait for 4 secondsdigitalWrite(LED, LOW); // turn the LED off by making the voltage LOWdelay(1000); // wait for a second} On this board interval for ON (sleep command) visually is almost equal to OFF (delay command) interval (!). So SLEEP command is running about 4 times faster, than DELAY. While same code on MSP-EXP430G2 with MSP430G2553 and MSP-EXP430FR5969 boards is working fine. What is the reason ? It looks, like Energia library for MSP430FR2433 has some issues...Is it possible to fix it ? I understand, that MSP430G2xxx and MSP430FR2xxx have differences, but some basic functions should be running the same...isn't it ? Quote Link to post Share on other sites
LIJsselstein 9 Posted September 19, 2018 Share Posted September 19, 2018 I think this is because, when there is no external XTAL connected, Energia (wiring) usually falls back to the VLO source (~12k Hz). But on the FR2433 the clock falls back to the REFO source which runs about 3x faster ( ~32768 Hz). However the code in wiring.h does not reflect this. Please look around line 144 in wiring.c (hardware/energia/msp430/cores/msp430/wiring.c): /* ACLK = VLO = ~ 12 KHz */ vlo_freq = 8000; /* Source ACLK from REFO */ CSCTL4 |= SELA__REFOCLK; Where I think it should be: /* ACLK = REFO = ~ 32 KHz */ vlo_freq = 32768; /* Source ACLK from REFO */ CSCTL4 |= SELA__REFOCLK; Since Sleep() uses the clock for timing and Delay() uses the CPU frequency for timing, this could explain your difference. Pinging @StefanSch veryalive 1 Quote Link to post Share on other sites
Jamesgrr 1 Posted September 21, 2018 Share Posted September 21, 2018 . Hey Kreitzz, I would be interested to know if you have tried using sleepseconds with any different results. I am using the same board and am hoping to get low power sleep working as well. 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.