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

nRF9160 with CCS811 and Missing Log in LTE Link Monitor

Hello,

I am trying to interface to a CCS811 sensor found here to the nRF9160 DK. I am using NCS v1.2.0.

I followed the instructions from the blog here which covers how to do this with a BME280 example and adapted them to work with the CCS811 sensor. Please verify if there are any missing steps or other places that need changing:

  1. I copied the CCS811 example from ncs\zephyr\samples\sensor\ccs811 to ncs\nrf\samples\nrf9160\ccs811
  2. I created an nrf9160_pca10090ns.overlay file as shown below.
  3. I modified line 115 of main.c to use my device label "CCS811"
  4. I added CONFIG_I2C_2=y to prj.conf
  5. I build the project using west build -b nrf9160_pca10090ns

When I run this example and look at the logs using LTE Link Monitor (latest version v1.1.1) all I see is this (It's stuck on the "*** Booting Zephyr OS build v2.1.99-ncs1 ***" line):

When I run the exact same example looking at the logs with Tera Term, I see one additional line ("Failed to get device binding"):

I am disconnecting from one terminal before opening the other and simply resetting the board (by pressing the reset button) to reboot. I don't have the sensor hooked up to my board so that explains why I am seeing the "Failed to get device binding" message in Tera Term but why am I not seeing that message in LTE Link Monitor?

line 115 of main.c edited

struct device *dev = device_get_binding("CCS811");

added to prj.conf

CONFIG_I2C_2=y

nrf9160_pca10090ns.overlay

&i2c2 {
	status = "ok";
	sda-pin = < 12 >;
	scl-pin = < 11 >;
    clock-frequency = <I2C_BITRATE_STANDARD>;  
	
	/* The I2C address could be one of two, here 0x5A is assumed */
	ccs811@5A {
		compatible = "ams,ccs811";
		reg = <0x5A>;
		label = "CCS811";
	};
};

merged.hex for nrf9160_pca10090ns: /cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-d9f2a3f32f4949a8ba7acdd814276ae3/1856.merged.hex

Full Project here: /cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-d9f2a3f32f4949a8ba7acdd814276ae3/4454.ccs811.zip

Regards,

Akash Patel

  • Hi Akash,

    I think the reason you're not seeing the last line in the Link Monitor, is because there's no newline '\n' character at the end of that print, and it seems Link Monitor outputs on a per-line basis.

    Regarding the change on line 115, I think you can leave it as it was originally. The define will be generated using the CCS811 entry in the overlay file.
    You can confirm that by looking in "build/zephyr/include/generated/devicetree_unfixed.h" and check that it's correctly defined.

    Note that you can also specify interrrupt, reset and wake-up GPIOs in the overlay, and they will then be used by the driver to provide that functionality, like this:

    &i2c2 {
    	status = "ok";
    	sda-pin = < 12 >;
    	scl-pin = < 11 >;
        clock-frequency = <I2C_BITRATE_STANDARD>;
    
    	/* The I2C address could be one of two, here 0x5A is assumed */
    	ccs811@5A {
    		compatible = "ams,ccs811";
    		reg = <0x5A>;
    		label = "CCS811";
    		reset-gpios = <&gpio0 21 0>;
    		wake-gpios = <&gpio0 22 0>;
    		irq-gpios = <&gpio0 23 0>;
    	};
    };
    

    Where 21, 22 and 23 are pin numbers, and 0s are GPIO flags.

    It's not entirely clear to me from the driver code if these pins are required for the sensor to function properly.

    Best regards,

    Jan Tore

  • Hello Akash,

    Was this helpful? I had similar issues I followed the steps but I get this error "Failed to get device binding"

  • Hello Aditya,

    I see that you have opened a ticket for the issue here. I would encourage you to work with the team in that ticket. Hopefully you will get a response soon. It will also be helpful if you included in that ticket your SDK version and your source code for the project. You should be edit your original post to include that information.

    Regards,

    Akash

  • Thank you, I will do that. 
    Just for the information sake, which CCS811 sensor were you using? The one by Sparkfun or by Adafruit?

  • Hi I am using the one with 5A register, but I am also getting "Failed to get device binding". Have you managed to communicate with the CCS811?

Related