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:
- I copied the CCS811 example from ncs\zephyr\samples\sensor\ccs811 to ncs\nrf\samples\nrf9160\ccs811
- I created an nrf9160_pca10090ns.overlay file as shown below.
- I modified line 115 of main.c to use my device label "CCS811"
- I added CONFIG_I2C_2=y to prj.conf
- 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