I can't connect bme280 via SPI with a nrf52833 based board

I'm using a EVK-NINA-B4 based on nrf52833 board and VS code with nrf connect SDK extension. I am trying to interface a bme280 sensor via SPI using the bme280 example but I didn't succeed. As a beginner I think this might be a configuration problem. It worked using I2C protocol but not SPI. I didn't change anything in main.c. I always get the same answer in the terminal:  Device bme280 is not ready; " "check the driver initialization logs for errors. That's the configuration I used:

prj.conf:

CONFIG_SENSOR=y
CONFIG_SPI=y
CONFIG_BME280=y

I created an overlay file with the same board name (ubx_evkninab4_nrf52833.overlay):

&arduino_spi {
    status = "okay";
    cs-gpios = <&gpio0 0 0>;
    bme280@0 {
        compatible = "bosch,bme280";
        reg = <0>;
        spi-max-frequency = <1000000>; /* conservatively set to 1MHz */
    };
};

Parents Reply Children
Related