Jump to content
43oh

[Energia Library] Bosch BMP085 Template Library


Recommended Posts

  • 5 months later...
  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

I finished up my first Energia project, a template library for the Bosch BMP085 temperature and pressure sensor. It uses I2C and supports temperature in Celsius and pressure in Pascal.   https://githu

Now tested on StellarPad and Arduino.

@@abecedarian From a quick glance at the source, Energia does only check whether USCI is present and then uses UCB0, which is wired to the same pins for G2553 and F5529. 4.2/4.1 would be UCB1.   IMO

Posted Images

@@RobLewis @@bogdanvisan20
 
Ok, I rewrote the I2C part of the library so that it properly uses beginTransmission and endTransmission() and it now seems to work with Energia 16 and the G2 launchpad.

 

I remember that I had to fudge with begin/endTransmission originally to work around oddities of the Energia I2C implementation. It looks like Energia is fixed now and my workarounds are broken.

 

Below the corrected bit of code (towards the bottom of BMP085_t.h). I will update it on GitHub shortly.

  // send command to BMP085
  void m_sendCmd(uint8_t cmd) {  
    Wire.beginTransmission(i2caddress);
    Wire.write(byte(BMP085_REG_CTRL));      
    Wire.write(byte(cmd));
    Wire.endTransmission();
  }
  
  // read 8 bits from I2C
  uint8_t m_read8(uint8_t addr) {
    uint8_t ret;

    Wire.beginTransmission(i2caddress);
    Wire.write(addr);
    Wire.endTransmission();

    Wire.beginTransmission(i2caddress);
    Wire.requestFrom(i2caddress, (uint8_t)1);    // need to cast int to avoid compiler warnings
    ret = Wire.read();
    Wire.endTransmission();
	
    return ret;
  };

  // read 16 bits from I2C
  uint16_t m_read16(uint8_t addr) {
    uint16_t ret;
	
    Wire.beginTransmission(i2caddress);
    Wire.write(addr);
    Wire.endTransmission();

    Wire.beginTransmission(i2caddress);
    Wire.requestFrom(i2caddress, (uint8_t)2);    // need to cast int to avoid compiler warnings
    ret = (Wire.read() << 8) | Wire.read();
    Wire.endTransmission();
	
    return ret;
  };
Link to post
Share on other sites
  • 2 months later...

hello ...i am very new to this world...i have to interface bosch bme280 with msp432 launchpad...i have done 12c interface and have been able to see the output in serial monitor of energia ...i have a sharp lcd boosterpack and have to show the sensor output there but dont know how ..can anyone help ??

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

1 Thanks for this library, very useful

2 I have been struggling for a long time to get this to work. I tried energia v17 and it wouldn't work but the cause wasn't obvious to me.  So i tried many things and wories I'd fried something.  Changing to energia v16 it worked immediately

 

I have an msp430g2553 with msp-exp430g2 rev1.3.  I have also removed c24 and r34 (I can't remember why) and have txd and rxd cross jumpered.  I am running a BMP85 chip that I've soldered myself with 5k pullups and decoupling cap.

 

Hope this helps someone

Link to post
Share on other sites
  • 7 months later...
  • 7 months later...
On 12/19/2015 at 2:58 PM, Towhid said:

hello ...i am very new to this world...i have to interface bosch bme280 with msp432 launchpad...i have done 12c interface and have been able to see the output in serial monitor of energia ...i have a sharp lcd boosterpack and have to show the sensor output there but dont know how ..can anyone help ??

Could you share the code for this?

Link to post
Share on other sites
  • 7 months later...

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