Jump to content
Sign in to follow this  
codyneslen

Energia Example WirelessMonitorSensor wont compile

Recommended Posts

Hi Everyone!
 
I am trying to use the AIR430 Booster pack, MSP430G2452 uC and programming it with Energia 0101E0012 on a Mac. If I simply try to compile the examples given in energia (for example, WirelessMonitorSensor), I get a compile error as follows:
 
/Applications/Energia.app/Contents/Resources/Java/hardware/msp430/libraries/AIR430BoostUSAFCC/utility/Platform.cpp: In function 'void A110x2500SpiRead(unsigned char, unsigned char*, unsigned char)':
/Applications/Energia.app/Contents/Resources/Java/hardware/msp430/libraries/AIR430BoostUSAFCC/utility/Platform.cpp:84:28: error: 'SPIMISO_SET_MODE' was not declared in this scope
/Applications/Energia.app/Contents/Resources/Java/hardware/msp430/libraries/AIR430BoostUSAFCC/utility/Platform.cpp: In function 'void A110x2500SpiWrite(unsigned char, const unsigned char*, unsigned char)':
/Applications/Energia.app/Contents/Resources/Java/hardware/msp430/libraries/AIR430BoostUSAFCC/utility/Platform.cpp:114:28: error: 'SPIMISO_SET_MODE' was not declared in this scope

 
If I write my own program that just loads the AIR430BoosFCC.h and SPI.h headers (using the Sketch/Import Library.../AIRBoostUSAFCC), I get a different error:

In file included from /Applications/Energia.app/Contents/Resources/Java/hardware/msp430/libraries/AIR430BoostUSAFCC/AIR430BoostFCC.h:29:0,
                 from test.ino:1:
/Applications/Energia.app/Contents/Resources/Java/hardware/msp430/libraries/AIR430BoostUSAFCC/utility/A110x2500Radio.h:109:10: error: 'boolean' does not name a type

 
The code to generate this error is:

 

#include <AIR430BoostFCC.h>
#include <SPI.h>
 
void setup()
{
  pinMode(RED_LED,INPUT);
  Serial.begin(9600);
  
}
 
void loop()
{
  Serial.println("Hello World");
  delay(1000);  
}
 
Any ideas how to get this working? Thanks!

Share this post


Link to post
Share on other sites

Turns out that the USI based SPI implementation was never converted to use the new pinMode_int() that set the appropriate SELx registers.

 

Try adding the follwoing lines to hardware/msp430/variants/launchpad/pins_energia.h just under the "#if defined(__MSP430_HAS_USI__)" together with the other XXX_SET_MODE defines.

#define SPISCK_SET_MODE (PORT_SELECTION0)
#define SPIMOSI_SET_MODE (PORT_SELECTION0)
#define SPIMISO_SET_MODE (PORT_SELECTION0)

Below is the actual patch:

diff --git a/hardware/msp430/variants/launchpad/pins_energia.h b/hardware/msp430/variants/launchpad/pins_energia.h
index 005425f..fa5f7d6 100644
--- a/hardware/msp430/variants/launchpad/pins_energia.h
+++ b/hardware/msp430/variants/launchpad/pins_energia.h
@@ -69,6 +69,9 @@ static const uint8_t DEBUG_UARTTXD = 3;  /* Transmit Data (TXD) at P1.1 */
 #define TWISCL_SET_MODE  (PORT_SELECTION0 | INPUT_PULLUP)
 #define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT)
 #define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT)
+#define SPISCK_SET_MODE (PORT_SELECTION0)
+#define SPIMOSI_SET_MODE (PORT_SELECTION0)
+#define SPIMISO_SET_MODE (PORT_SELECTION0)
 #endif
 
 #define DEBUG_UART_MODULE 0x0

Share this post


Link to post
Share on other sites

That did the trick, thanks!

 

Also, I discovered that you must include SPI.h before AIR430BoostFCC.h or it throws the compile error I showed in my hello world program above. When using the sketch/import buttons, the AIR430BoostFCC.h is included before SPI.h and gives the error. I am sure you could explain why this happens (I have not investigated it), but I thought I would let you all know!

 

The correct include order is:

#include <SPI.h>
#include <AIR430BoostFCC.h>

Thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×