Errors when using BME680 Sample Code

Hi,

I am trying to run the sample code for the BME680 sensor over I2C.

I am using the sample code as is; the only modification is my overlay file to define the I2C pins as below.

&i2c0 {
	compatible = "nordic,nrf-twim";	
	status = "okay";
	sda-pin = <17>;
	scl-pin = <20>;
	clock-frequency = <I2C_BITRATE_STANDARD>;
	bme680@76 {
		compatible = "bosch,bme680";
		reg = <0x76>;
		label = "BME680";
	};
};

when i try to build, I get a whole host of errors......

/Users/Watt/Documents/ZEPHYR_Code/nRF52840_Dongle/zephyr/include/toolchain/gcc.h:62:36: error: static assertion failed: "Devicetree node /soc/i2c@40003000 must have exactly one of the sda-pin and sda-gpios properties set. Note: you can use /delete-property/ to delete properties."
   62 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
      |                                    ^~~~~~~~~~~~~~
/Users/Watt/Documents/ZEPHYR_Code/nRF52840_Dongle/zephyr/soc/arm/nordic_nrf/nrf52/../soc_nrf_common.h:85:2: note: in expansion of macro 'BUILD_ASSERT'
   85 |  BUILD_ASSERT(       \
      |  ^~~~~~~~~~~~
/Users/Watt/Documents/ZEPHYR_Code/nRF52840_Dongle/zephyr/drivers/i2c/i2c_nrfx_twim.c:328:2: note: in expansion of macro 'NRF_DT_PSEL_CHECK_EXACTLY_ONE'
  328 |  NRF_DT_PSEL_CHECK_EXACTLY_ONE(I2C(idx),           \
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Watt/Documents/ZEPHYR_Code/nRF52840_Dongle/zephyr/drivers/i2c/i2c_nrfx_twim.c:371:1: note: in expansion of macro 'I2C_NRFX_TWIM_DEVICE'
  371 | I2C_NRFX_TWIM_DEVICE(0);
      | ^~~~~~~~~~~~~~~~~~~~
/Users/Watt/Documents/ZEPHYR_Code/nRF52840_Dongle/zephyr/include/toolchain/gcc.h:62:36: error: static assertion failed: "Devicetree node /soc/i2c@40003000 must have exactly one of the scl-pin and scl-gpios properties set. Note: you can use /delete-property/ to delete properties."
   62 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
      |                                    ^~~~~~~~~~~~~~
/Users/Watt/Documents/ZEPHYR_Code/nRF52840_Dongle/zephyr/soc/arm/nordic_nrf/nrf52/../soc_nrf_common.h:85:2: note: in expansion of macro 'BUILD_ASSERT'
   85 |  BUILD_ASSERT(       \
      |  ^~~~~~~~~~~~
/Users/Watt/Documents/ZEPHYR_Code/nRF52840_Dongle/zephyr/drivers/i2c/i2c_nrfx_twim.c:331:2: note: in expansion of macro 'NRF_DT_PSEL_CHECK_EXACTLY_ONE'
  331 |  NRF_DT_PSEL_CHECK_EXACTLY_ONE(I2C(idx),           \
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Watt/Documents/ZEPHYR_Code/nRF52840_Dongle/zephyr/drivers/i2c/i2c_nrfx_twim.c:371:1: note: in expansion of macro 'I2C_NRFX_TWIM_DEVICE'
  371 | I2C_NRFX_TWIM_DEVICE(0);
      | ^~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.

 Regards,

Rod

Parents Reply Children
  • Hi, 

    I managed to get it working. I updated my overlay file to remove the gpios as below

    &i2c1 {
    /delete-property/sda-gpios;
    /delete-property/scl-gpios;
    };
    
    &i2c1 {
    	compatible = "nordic,nrf-twi";	
    	status = "okay";
    	sda-pin = <17>;
    	scl-pin = <20>;
    	clock-frequency = <I2C_BITRATE_STANDARD>;
    	bme680@77 {
    		compatible = "bosch,bme680";
    		reg = <0x77>;
    		label = "BME680";
    	};
    };
    

    This has enabled it to work. I am not sure why I had to explicitly disable the sda and scl pins but it works!

    Rod

Related