Jump to content
43oh

MSP30FR2433: SLEEP command not working correctly


Recommended Posts

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 seconds
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(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 ?

Link to post
Share on other sites
  • 5 weeks later...

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

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