Saturday, April 4, 2015

Adafruit BMP183 Sensor and MSP430 using Energia

I finally got the Adafruit BMP183 sensor to work with a MSP-EXP430F5529LP and Energia.  I am using the Adafruit library and it almost works but not quite for the LaunchPad.  The following changes are necessary:
  • As you would expect, it is necessary to change pins for SPI.  I used the following in the test sketch provided as an example by the library:
           #define BMP183_CLK  P4_3
           #define BMP183_SDO  P4_2    // AKA MISO
           #define BMP183_SDI  P4_1     // AKA MOSI
           #define BMP183_CS   P4_0
           Adafruit_BMP183 bmp = Adafruit_BMP183(BMP183_CLK, BMP183_SDO,

               BMP183_SDI,BMP183_CS);
  • The sketch won't compile as is because of a call to _delay_ms in Adafruit.BMP183.cpp provided in the library.  I replaced all instances with the delay function.
  • The sketch won't compile as is because of a call to the pow function in Adafruit.BMP183.cpp.  The offending error is in the altitude calculation and occurs because of a bug in the gcc compiler used by Energia for the MSP430.  Replace pow with powf and it should work.
Follow the link on the Adafruit BMP183 sensor and check out their learning system for a whole lot more information.

No comments:

Post a Comment