BME680 sensor

, Jul 23, 2023|
0
21466
8
Hi,

I am trying to get the chip ID of the BME680 sensor on my NuMaker_IoT_M487 board using the hardwired I2C interface.

I have tried both 7bit & 8bit addressing in a simple I2C C++ example. I cannot read the ID properly. I only get 0x00.

What am I doing wrong, please?

Code snippet:

#include "mbed.h"
I2C i2c(I2C_SDA , I2C_SCL );

// Set to BME680 sensor I2C address
const int addr7bit = 0x76; // 7 bit I2C address
const int addr8bit = 0x76 << 1; // 8bit I2C address

int main() {

char cmd=0;
char result=0;

while (1) {

cmd = 0xD0;
i2c.write(addr7bit, &cmd, 1);
i2c.read (addr7bit, &result, 1);
printf("BME68X_CHIP_ID 7bit = %hhx\n", result);

wait_us(500000);

cmd = 0xD0; //CHIP_ID
i2c.write(addr8bit, &cmd, 1);
i2c.read (addr8bit, &result, 1);
printf("BME68X_CHIP_ID 8bit = %hhx\n", result);

wait_us(500000);
}
}

Reply

  • Could you please try the example?
    https://os.mbed.com/teams/Nuvoton/code/NuMaker-mbed-Sensor-BME680-example/

    There is a BME680 on NuMaker-IoT-M263A board, so we provided this example to read it.
    However, it is easy to apply to other NuMaker IoT board if BME680 has connected to I2C pins.
    • Import this example to your tool (Mbed Studio, CLI, or Keil Studio Cloud)
    • Select target board to NuMaker-IoT-M487
    • Build it.
  • Silly me!

    I misunderstood. There is no BME680 on the M487. I was confused by the schematic diagram that shows U7 is connected to the processor.
    BUT, U7 does not exist on the NuMake_IoT_M487. The location is un-populated.

    So, close this request for support.

    Phil
  • I guess I pose the question.

    Are Nuvoton going to populate the M487 with U7, giving it the BME680 sensor capabilities?????

    regards

    Phil
  • The current NuMaker-IoT-M487 board is version 1.3. So far as I know, there are no plans for updates in the near future. Therefore, the BME680 will not be placed on the board.
  • Hi,

    If you look at the v1.3 PCB you can see that there is a space and the pads for the BME680. For some reason the PCB was not assembled with that part placed in position U7.

    So, it does not require a board revision from what I can see. Unless there are missing some I2C wire pull-up resistors, as I could not see any on the schematic published in UM_NuMaker-IoT-M487_User_Manual_EN_Rev1.01.pdf

    Phil
  • Hi,

    I carefully soldered a BME680 to the M487 PCB and got it working, using

    I2C i2c(PD_0 , PD_1); defined in my code.

    I have now engineered a daughter board which is Arduino Uno compatible. Your datasheet (UM_NuMaker-IoT-M487_User_Manual_EN_Rev1.01.pdf) shows that pins PG_1 (SDA) and PG_0 (SCL)
    are wired to I2c0 port. But when I try and call the interface I get no signals sent out (I monitor with a logic analyser). The pins are correct, but no signals are detected on the i2c pins.

    I2C i2c(PG_1 , PG_0); // Used inside the BME680 Mbed Lib. f for Frontpanel PCB v5


    What am I doing wrong?
  • I have figured it out, but still have a question.

    I need pullup resistors on the I2C_SDA and I2C_SCL pins in the arduino connector.

    BUT, I should be able to these pins to have a pullup resistor programmed inside Mbed.

    I have tried

    DigitalOut sdaDummy(I2C_SDA, PullUp);
    DigitalOut sclDummy(I2C_SCL, PullUp);
    I2C i2c(I2C_SDA, I2C_SCL); // Used inside the BME680 Mbed Lib.

    This does not work. I have tried to use

    I2C_SDA.mode(PullUp); but this creates an error during compile "Unknown type name I2C_SDA"

    I guess I will need to add external pull resistors to my PCB.

    Can anyone suggest a work around, please?

    Phil
  • The M487 microcontroller has internal pull-up/pull-down resistors, but these are limited to certain GPIO modes. When the pins are switched to I2C mode, the internal pull-up/pull-down functionality is no longer available. Therefore, mixed use is not possible.