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

BME280 with NRF5340 display (T,P,H) problem

Hello everybody,

I'm having a problem to display the temperature, pressure and humidity.

i followed this tutorial on a NRF5340 https://devzone.nordicsemi.com/nordic/b/archives/posts/nrf-connect-sdk-tutorial---part-3-temporary

in my case i'm using SES V5.34a avec NRF Connect v3.7.0 with NRF SDK V1.5.1

i'm working with BME280 adafruit! (3-5)voltage

below is my nrf5340dk_nrf5340_cpuapp.overlay

as the scl pin is on P1.03 and the sda is on P1.02

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
&i2c1 {
compatible = "nordic,nrf-twim";
status = "okay";
sda-pin = < 34-32 >;
scl-pin = < 34-31 >;
clock-frequency = <100000>;
/* The I2C address could be one of two, here 0x76 is assumed */
bme280@76 {
compatible = "bosch,bme280";
reg = <0x76>;
label = "BME280";
};
};
&uart1 {
status = "disabled";
};
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

and my prj.conf is below

Fullscreen
1
2
3
CONFIG_SENSOR=y
CONFIG_BME280=y
CONFIG_I2C_1=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

and for the main.c i useed the code linked on the nfr/samples/sensor/bme280

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Copyright (c) 2012-2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/sensor.h>
#define BME280 DT_INST(0, bosch_bme280)
#if DT_NODE_HAS_STATUS(BME280, okay)
#define BME280_LABEL DT_LABEL(BME280)
#else
#error Your devicetree has no enabled nodes with compatible "bosch,bme280"
#define BME280_LABEL "<none>"
#endif
void main(void)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

my build is going well on SES and it's successful but when i try west flash from bash or Cmd prompt i'm always getting errors 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
C:\Users\rzaafouri\ncs\v1.5.1\nrf\samples\sensor\bme280>west flash
-- west flash: rebuilding
[0/1] Re-running CMake...
Including boilerplate (Zephyr base (cached)): C:/Users/rzaafouri/ncs/v1.5.1/zephyr/cmake/app/boilerplate.cmake
-- Application: C:/Users/rzaafouri/ncs/v1.5.1/nrf/samples/sensor/bme280
-- Using NCS Toolchain 1.6.0 for building. (C:/Users/rzaafouri/ncs/v1.6.0/toolchain/cmake)
-- Zephyr version: 2.4.99 (C:/Users/rzaafouri/ncs/v1.5.1/zephyr)
-- Found west (found suitable version "0.11.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Cache files will be written to: C:/Users/rzaafouri/ncs/v1.5.1/zephyr/.cache
-- Found dtc: C:/Users/rzaafouri/ncs/v1.6.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found toolchain: gnuarmemb (C:/Users/rzaafouri/ncs/v1.6.0/toolchain/opt)
-- Found BOARD.dts: C:/Users/rzaafouri/ncs/v1.5.1/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
-- Found devicetree overlay: C:/Users/rzaafouri/ncs/v1.5.1/nrf/samples/sensor/bme280/boards/nrf5340dk_nrf5340_cpuapp.overlay
Error: nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:698.16-17 syntax error
FATAL ERROR: Unable to parse input tree
CMake Error at C:/Users/rzaafouri/ncs/v1.5.1/zephyr/cmake/dts.cmake:205 (message):
command failed with return code: 1
Call Stack (most recent call first):
C:/Users/rzaafouri/ncs/v1.5.1/zephyr/cmake/app/boilerplate.cmake:533 (include)
C:/Users/rzaafouri/ncs/v1.5.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

could you please help me solve my problem and be able to get returned values of my sensor bme280

or if you see that i have something wrong with my configuration, don't hesitate to tell . 
i will really appreciate your help and contribution 

thank you in advance