This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BME680 sample on nRF5340

Hi, 

I am trying to interface a BME680 sensor with my nRF5340 DK. I am trying to get the following sample to run (I left everything default): https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/sensor/bme680/README.html

When building I get the following error:

'DT_N_INST_0_bosch_bme680_P_label' undeclared (first use in this function)

Is there anything specific I need to configure? I'm not sure what to do, this is quite new to me.

Kind regards,

Stefan

Parents Reply Children
  • I guess you can use either cpuapp or cpuappns, depending if you want to execute from the secure area or not. 

  • I just tested this, it leads to the same error again. I even tried renaming nrf5340dk_nrf5340_cpuapp.overlay to nrf5340dk_nrf5340_cpuappns.overlay but that didn't help. Not sure if this has something to do with how it's being compiled or it can't find the overlay file if I switch to non secure?  

  • I just tried, for me it actually compiles after renaming the overlay file. Have you deleted the build folder before running west build?

    Is there a particular reason why you want to use non-secure?

  • That indeed did the trick. I thought the 'clean solution' command removed that folder but I guess it didn't do it (completely). 

    Now for the next challenge. I now see the following output looping:

    *** Booting Zephyr OS build v2.4.99-ncs1  ***
    Device (nil) name is <
    *** Booting Zephyr OS build v2.4.99-ncs1  ***
    Device (nil) name is <
    *** Booting Zephyr OS build v2.4.99-ncs1  ***
    Device (nil) name is <

    It seems like it is not reading the overlay file properly? And then it reboots with no error.

    These are the contents of the overlay file:

    nrf5340dk_nrf5340_cpuapp.overlay
    
    /*
     * Copyright (c) 2020, Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    &i2c1 {
    	compatible = "nordic,nrf-twim";
    	status = "okay";
    	sda-pin = < 30 >; //P0.30
    	scl-pin = < 31 >; //P0.31
        clock-frequency = <I2C_BITRATE_STANDARD>; 
    	
    	bme680@76 {
    		compatible = "bosch,bme680";
    		reg = <0x76>;
    		label = "BME680";
    	};
    };

  • I think the overlay file is being read correctly, the compiler would tell you otherwise.

    The device_get_binding() function is returning you a NULL pointer which means it couldnt find the device. So my guess would be that the connection is not correct or the address is wrong. 

    Can you check if the SDA/SCL pins and the BME680 address are correct? If I remember correctly, the BME680's default address is 0x77 instead of 0x76 (which you can set to with a jumper). So that would be my bet here Slight smile

Related