BME280 Not working on v2.1.1

Hi,

I have recently updated to V2.1.1 and I can no longer get my BME280 sensor to work.

I am using the standard code from the samples  directory, 

 
my overlay file is this

my prj file looks like this

 I am using VS and the line "CONFIG_BME280=y" shows a warning

What am I missing?


Rod

Parents
  • Hello,

    The error indicates that the BM280 is not enabled in your DT. Please add the "status = "okay";  line to your overlay as shown here: https://github.com/nrfconnect/sdk-zephyr/blob/d9f99ed1951a973c691cd5d6bd70aecb597b2030/boards/arm/bl654_sensor_board/bl654_sensor_board.dts#L87

    Best regards,

    Vidar

  • Hi Vidar,

    Thanks for the suggestion. I have updated my overlay file as suggested but still seeing the same error.

    Rod

  • Hi Rod,

    Could you check the generated zephyr dts in your build folder to see if it match your overlay (<build dir>/zephyr/zephyr.dts)?

    For comparison, this is what I get if I build the bme280 sample for the 'bl654_sensor_board':

    But this is now throwing an error, has this syntax changed?

    Yes, the peripheral IO properties were replaced with pinctrl. So, they are no longer defined in the board files.

    Vidar

  • Hi Vidar,

    Mine looks like this,

    Weirdly, its picking up arduino_i2c?

    Rod

  • Hi Rod,

    Do you still get the warning that the 'DT_HAS_BOSCH_BME280_ENABLED' dependency is missing? I tried now to build the sample for 'nrf52840dk_nrf52840' with the overlay you posted, but it appears to be working as expected for me.

    Generated zephyr.dts from nrf52840dk_nrf52840 build with overlay

    CONFIG_DT_HAS_BOSCH_BME280_ENABLED enabled in .config

    RodWatt said:
    Weirdly, its picking up arduino_i2c?

     This comes from the board file. Dev kits following the arduino form factor will typically define interfaces such as arduino_i2c, arduino_spi, etc to let the application know what i2c or SPI interface to select when connecting the board to arduino type shields. It's like a tag/label to help the program select the correct interface.

    Have you tried with the original bme280 sample as well?

  • Hi Vidar,

    I can see that CONFIG_DT_HAS_BOSCH_BME280_ENABLED is enabled in .config

    However, when I look at my config file, it says its set to n in build

    Yes, I have tried the original code, same error.

    Rod

  • Hi Rod,

    Thanks for confirming that CONFIG_DT_HAS_BOSCH_BME280_ENABLED is defined in .config. But do you still see this warning in your build log:

    ?

    It says CONFIG_BME280 is set to =n because CONFIG_DT_HAS_BOSCH_BME280_ENABLED is not selected.

    Vidar

Reply
  • Hi Rod,

    Thanks for confirming that CONFIG_DT_HAS_BOSCH_BME280_ENABLED is defined in .config. But do you still see this warning in your build log:

    ?

    It says CONFIG_BME280 is set to =n because CONFIG_DT_HAS_BOSCH_BME280_ENABLED is not selected.

    Vidar

Children
  • Hi Vidar,

    No I dont see that error any more, just this one

    Rod

  • Hi Rod,

    OK, this is a good step in the right direction. I have only been focusing on the "CONFIG_DT_HAS_BOSCH_BME280_ENABLED not defined" warning until now. The 2nd error which you are seeing now is a runtime error and comes from the driver here: https://github.com/nrfconnect/sdk-zephyr/blob/main/drivers/i2c/i2c_nrfx_twim.c#L171, and it occurs during initialisation of the driver on startup.

    It sounds like you were able to interface with the sensor before you updated to SDK v2.1.1. What version did you use previously? Also, is there anything else that have changed? Pin assignments, etc?

    The best way to troubleshoot this further may be to use a logic analyzer and probe the bus lines, if you have one available.

    Vidar

  • Hi Vidar,

    Sorry, I was mistaken, the "CONFIG_DT_HAS_BOSCH_BME280_ENABLED not defined" is still there.

    I cant recall when this stopped working, I know it worked before the changes to the overlay file.

     Errors when using BME680 Sample Code 

    Since then, the board hasn't changed, the pinout hasn't changed, 

    Rod

  • Hi Rod,

    I notice you are setting the i2c address to 0x77 in the overlay you posted here:  RE: Errors when using BME680 Sample Code and 0x76 in the one you posted here. Could this be the reason? I guess you could also try to use the TWI instead of the TWIM peripheral by changing "compatible" from "compatible = "nordic,nrf-twim"; to compatible = "nordic,nrf-twi";

    Best regards,

    Vidar

  • Hi Vidar,

    Sorry, maybe that was a bad example. The '680 is 0x77, the '280 is 0x76.I have tried both. I have also tried both twi and twin.

    Rod