I'm using a custom board based upon the nRF52840. The BME680 chip works fine in another RTOS but the zephyr/nRF connect example is throwing errors.
I added a fair amount of debug logging to the example code and to files such as device.c and am not able to understand what is the most likely cause for this error
*** Booting nRF Connect SDK 3758bcbfa5cd *** [00:00:00.750,457] <inf> app: Starting application [00:00:00.750,793] <dbg> device: z_device_is_ready: Checking device readiness: gpio@50000000, initialized: 1, init_res: 0 [00:00:00.751,373] <inf> app: Found GPIO device: gpio@50000000 [00:00:00.751,770] <inf> app: Configured GPIO pin 31 on device gpio@50000000 [00:00:00.752,197] <inf> app: Set GPIO pin 31 high on device gpio@50000000 [00:00:00.752,624] <dbg> device: z_device_is_ready: Checking device readiness: I2C_0, initialized: 1, init_res: 0 [00:00:00.753,204] <inf> app: Found I2C device: I2C_0 [00:00:00.753,509] <inf> app: Scanning I2C bus... [00:00:00.774,169] <inf> app: Found I2C device at address 0x6a [00:00:00.776,672] <inf> app: Found I2C device at address 0x76 [00:00:00.777,191] <inf> app: I2C scan complete [00:00:00.778,015] <inf> app: BME680 chip ID: 0x61 [00:00:03.778,411] <inf> app: Device 0x9f94 name is bme680@76 [00:00:03.778,778] <dbg> device: z_device_is_ready: Checking device readiness: bme680@76, initialized: 1, init_res: 5 [00:00:03.779,357] <err> app: sensor: device not ready. Device name: bme680@76 [00:00:03.779,815] <dbg> device: z_device_is_ready: Checking device readiness: bme680@76, initialized: 1, init_res: 5
Basically what is I see happening is that the I2C is working and can enumerate the sensors but, for some reason, the BME680 sensor is not initializing correctly.
prj.conf:
CONFIG_STDOUT_CONSOLE=y CONFIG_GPIO=y CONFIG_I2C=y CONFIG_SENSOR=y CONFIG_BME680=y CONFIG_I2C_INIT_PRIORITY=60 CONFIG_LOG=y CONFIG_LOG_DEFAULT_LEVEL=3 CONFIG_LOG_MODE_IMMEDIATE=y CONFIG_SENSOR_LOG_LEVEL_INF=y CONFIG_I2C_LOG_LEVEL_INF=y CONFIG_SENSOR_LOG_LEVEL_DBG=y CONFIG_I2C_LOG_LEVEL_DBG=y CONFIG_MAIN_STACK_SIZE=2048 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
DTS file snippet
&i2c0 { compatible = "nordic,nrf-twi"; status = "okay"; label = "I2C_0"; pinctrl-0 = <&i2c0_default>; pinctrl-1 = <&i2c0_sleep>; pinctrl-names = "default", "sleep"; bme680@76 { compatible = "bosch,bme680"; reg = <0x76>; status = "okay"; supply-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; }; *****<SNIP>**** &i2c0_default { group1 { psels = <NRF_PSEL(TWIM_SDA, 0, 26)>, <NRF_PSEL(TWIM_SCL, 0, 27)>; //bias-pull-up; }; }; &i2c0_sleep { group1 { psels = <NRF_PSEL(TWIM_SDA, 0, 26)>, <NRF_PSEL(TWIM_SCL, 0, 27)>; low-power-enable; }; };