RobLewis 7 Posted April 16, 2015 Share Posted April 16, 2015 Make sure you use the latest version as available on GitHub, it was tested with the MSP430F5529 launchpad. https://github.com/astuder/BMP085-template-library-Energia Make sure to call Wire.begin and optionally Wire.setModule before using the library. That being said, I haven't touched Energia in a while, so it's possible that my code needs to be adjusted for newer versions. Thanks for the tip, but the newer library isn't working any better than the older one. It might help if I could find some documentation anywhere of the Wire.setmodule() method (especially as regards the MSP430F5529), but I can't. Quote Link to post Share on other sites
chicken 630 Posted April 16, 2015 Author Share Posted April 16, 2015 Looking through the official Energia source code on GitHub, I think setModule() is not yet supported for MSP430. Quote Link to post Share on other sites
chicken 630 Posted April 16, 2015 Author Share Posted April 16, 2015 There's a patch available in this thread to add the setModule for MSP430F5529: http://forum.43oh.com/topic/5174-getting-i2c1-ie-usci-b1-to-work-on-f5529-launchpad/?p=64796 Quote Link to post Share on other sites
RobLewis 7 Posted April 18, 2015 Share Posted April 18, 2015 The setModule issue may be a red herring. I re-flashed the old LaunchPad code that was working fine, and am still getting the error, so the current suspect is a failed BMP085 sensor. (The other attached sensor, a DHT22 humidity sensor, continues to work fine.) Anybody experienced reliability issues with this part? Mine has been mounted indoors out of the weather the whole time, and a failure after less than 2 years is hopefully a fluke. It appears Bosch has updated the sensor to a new (and improved?) part, the BMP180, which according to AdaFruit is pin- and software-compatible. So I guess I'll be ordering one. Quote Link to post Share on other sites
RobLewis 7 Posted April 28, 2015 Share Posted April 28, 2015 I replaced the BMP085 sensor with a new BMP180, which is claimed to be 100% compatible, though it seems to lack the EOC output that signals the end of a conversion. Adjusted the code to use wait loops instead of the EOC signal, but the new sensor seems to be doing exactly what the old one did. In the serial monitor, what I'm seeing is the value "2" being sent as the pressure reading. And I don't seem to be getting any temperature reading at all. The separate humidity sensor attached to the same MSP430F5529 continues to work fine. This smells to me like some kind of serial I/O bit timing issue, but why would it just suddenly start happening one day? Before I try recompiling the driver in debug mode, anybody got any tips where to look? Quote Link to post Share on other sites
chicken 630 Posted April 28, 2015 Author Share Posted April 28, 2015 Enabling debug would be my next step as well. And/or look at what's going on with the I2C lines with a logic analyzer or scope. You could also see, if it still works with older versions of Energia. I last tested with 0101E0010 or 11. Re EOC pin, if you specify "0" the library will do the delay for you. Quote Link to post Share on other sites
RobLewis 7 Posted April 30, 2015 Share Posted April 30, 2015 Still no luck getting my F5529 to read the BMP180. With or without DEBUG_BMP085 enabled, the program hangs in the begin() method. I added a print statement to the driver just before it tries to read the BMP085 CHIP ID. I see this printout but that's the last output I get, so apparently it is hanging trying to read the ID. I don't get the "BMP085 device not found" message. I wonder if there could be some problem in the Wire module. This is in Energia 15. Frustrating that this all worked fine for a long time. Quote Link to post Share on other sites
chicken 630 Posted April 30, 2015 Author Share Posted April 30, 2015 I had to patch old versions of Energia to properly support single-byte I2C reads. Maybe that broke again with newer versions. As workaround, you can try to update mread8 in the BMP template library: // read 8 bits from I2C uint8_t m_read8(uint8_t addr) { Wire.beginTransmission(i2caddress); Wire.write(addr); Wire.endTransmission(false); Wire.requestFrom(i2caddress, (uint8_t)2); // request 2 bytes uint8_t val = Wire.read(); Wire.read(); // dummy read for second byte.. return val; }; See this thread for all the gory detail:http://forum.43oh.com/topic/3154-i2c-issues/ Quote Link to post Share on other sites
RobLewis 7 Posted April 30, 2015 Share Posted April 30, 2015 I had to patch old versions of Energia to properly support single-byte I2C reads. Maybe that broke again with newer versions. As workaround, you can try to update mread8 in the BMP template library: // read 8 bits from I2C uint8_t m_read8(uint8_t addr) { Wire.beginTransmission(i2caddress); Wire.write(addr); Wire.endTransmission(false); Wire.requestFrom(i2caddress, (uint8_t)2); // request 2 bytes uint8_t val = Wire.read(); Wire.read(); // dummy read for second byte.. return val; }; See this thread for all the gory detail:http://forum.43oh.com/topic/3154-i2c-issues/ Darn, that sounded like the answer, but sadly I don't see any change. It still hangs trying to read the CHIP ID. Quote Link to post Share on other sites
RobLewis 7 Posted May 2, 2015 Share Posted May 2, 2015 Well, something different anyway. Now when I power cycle the board, the serial monitor shows this (which includes a few diagnostic print statements I added, and has the debug-enabled version of the driver): Setup has initialized Serial Setup has initialized Wire Attempting to read BMP085 CHIP ID with patched m_read8... BMP085 device not found Setup has initialized Serial, Wire, and Psensor Reading temperature.. UT=0 Reading pressure.. UP=0 Calculating temperature in 0.1 Celcius.. X1=0 X2=-1 B5=-1 T=0 Calculating pressure in Pascal.. B6=-4001 X1=0 X2=0 X3=0 B3=0 X1=0 X2=0 X3=0 B4=0 B7=0 p=-1 X1=1 X1=0 X2=0 p=235 Temperature: 0.0C Pressure: 2hPa Reading temperature.. UT=0 Reading pressure.. UP=0 Calculating temperature in 0.1 Celcius.. X1=0 X2=-1 B5=-1 T=0 Calculating pressure in Pascal.. B6=-4001 X1=0 X2=0 X3=0 B3=0 X1=0 X2=0 X3=0 B4=0 B7=0 p=-1 X1=1 X1=0 X2=0 p=235 Temperature: 0.0C Pressure: 2hPa Which repeats over and over, starting with "Reading temperature..". Why would it say "BMP085 device not found" and then proceed to act as though it had found one? Quote Link to post Share on other sites
chicken 630 Posted May 2, 2015 Author Share Posted May 2, 2015 Are you using the BMP085 or the BMP180? If the latter, try updating this line (with 180?) #define BMP085_CHIP_ID 85 or comment out "return;" in this code section of BMP085_t.h #ifdef DEBUG_BMP085 // verify that we're actually talking to a BMP085 sensor if(m_read8(BMP085_REG_ID) != BMP085_CHIP_ID) { Serial.println("BMP085 device not found"); return; } #endif If it dies after doing that, then the problem is with reading the calibration data. Quote Link to post Share on other sites
RobLewis 7 Posted May 3, 2015 Share Posted May 3, 2015 Tried changing this line: #define BMP085_CHIP_ID 85 to 180, and there was no change. Went back to 85, and commented out the return you suggested; still no joy. Here's what it's outputting now (note I still have your suggested patch in that discards the second byte for a 1-byte read): Setup has initialized Serial Setup has initialized Wire Attempting to read BMP085 CHIP ID with patched m_read8... BMP085 device not found AC1=8151 AC2=0 AC3=0 AC4=0 AC5=0 AC6=0 B1=0 B2=0 MB=0 MC=0 MD=0 Setup has initialized Serial, Wire, and Psensor Reading temperature.. UT=0 Reading pressure.. UP=0 Calculating temperature in 0.1 Celcius.. X1=0 X2=-1 B5=-1 T=0 Calculating pressure in Pascal.. B6=-4001 X1=0 X2=0 X3=0 B3=8151 X1=0 X2=0 X3=0 B4=0 B7=3887417296 p=-2 X1=1 X1=0 X2=0 p=234 Temperature: 0.0C Pressure: 2hPa Reading temperature.. UT=0 Reading pressure.. UP=0 Calculating temperature in 0.1 Celcius.. X1=0 X2=-1 B5=-1 T=0 Calculating pressure in Pascal.. B6=-4001 X1=0 X2=0 X3=0 B3=8151 X1=0 X2=0 X3=0 B4=0 B7=3887417296 p=-2 X1=1 X1=0 X2=0 p=234 Temperature: 0.0C Pressure: 2hPa And so on. Quote Link to post Share on other sites
chicken 630 Posted May 3, 2015 Author Share Posted May 3, 2015 Are you sure that you have the necessary i2C pull-ups in place? Quote Link to post Share on other sites
RobLewis 7 Posted May 3, 2015 Share Posted May 3, 2015 Are you sure that you have the necessary i2C pull-ups in place? It worked great for over a year with the BMP085 breakout board, and I haven't changed the hardware configuration except to try it with the new BMP180 breakout board (which lacks the EOC signal), because I thought the BMP085 had failed. Tomorrow I'll go back to the BMP085 and see what's reported by the driver in debug mode. (The humidity sensor which is connected to the same LaunchPad continues to work fine.) Quote Link to post Share on other sites
RobLewis 7 Posted May 3, 2015 Share Posted May 3, 2015 Success, sort of: By going back to the old BMP085 breakout board AND using the patch for the 8-bit read AND changing the F5529 board clock setting from 16 MHz to 25 MHz, I'm now getting apparently good data from the part: Setup has initialized Serial Setup has initialized Wire Attempting to read BMP085 CHIP ID with patched m_read8... AC1=7509 AC2=-1137 AC3=-14499 AC4=34075 AC5=24637 AC6=26359 B1=5498 B2=60 MB=-32768 MC=-11075 MD=2432 Setup has initialized Serial, Wire, and Psensor Reading temperature.. UT=33838 Reading pressure.. UP=42343 Calculating temperature in 0.1 Celcius.. X1=5623 X2=-2815 B5=2808 T=176 Calculating pressure in Pascal.. B6=-1192 X1=10 X2=661 X3=671 B3=7677 X1=2109 X2=29 X3=535 B4=34631 B7=1733300000 p=100101 X1=152881 X1=7086 X2=-11238 p=100078 Temperature: 17.6C Pressure: 1001hPa I always ran the board at 16 MHz before and it worked fine for a long time, but evidently something changed. I'm ignorant of Energia's internals, but if a low-CPU-demand routine works at 25 MHz and doesn't work at 16 MHz then I have to think something is wrong with how it's marking time. 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.