Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

SPI declaration

Hi all,

I'm using an nRF52-DK for testing the connections of pressure sensors (BME/BMP280), I tested first with arduino, and then I'm using the same code with Platformio in VScode.

The connection and code are the same so I'm not sure what is failing, maybe the declaration of pins.

an example would be:

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BMP280.h>

#define BMP_SCK  (13)
#define BMP_MISO (12)
#define BMP_MOSI (11)
#define BMP_CS   (10)

Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);

void setup() {
  Serial.begin(9600);
  Serial.println(F("BMP280 test"));

  //if (!bmp.begin(BMP280_ADDRESS_ALT, BMP280_CHIPID)) {
  if (!bmp.begin()) {
    Serial.println(F("Could not find a valid BMP280 sensor, check wiring or "
                      "try a different address!"));
    while (1) delay(10);
  }

}

void loop() {


    Serial.print(F("Pressure = "));
    Serial.print(bmp.readPressure());
    Serial.println(" Pa");
    

    Serial.println();
    delay(2000);
}

In Arduino IDE using Arduino UNO it woks.

In VScode with the nRF52-DK, the Terminal will show "Could not find a valid BMP280 sensor, check wiring or "
"try a different address!"

Can someone help me with this? is there a better way to read the pressure from this sensor?

Parents
  • Hello,

    In Arduino IDE using Arduino UNO it woks.

    In VScode with the nRF52-DK, the Terminal will show "Could not find a valid BMP280 sensor, check wiring or "
    "try a different address!"

    I am not familiar with the Arduino UNO or how this can be done in Arudino, unfortunately. Could you show me how you attempted to do this in VScode for the nRF52-DK?
    Could you also clarify if you are using the nRF5 SDK, or the NCS SDK? Which version are you working with?
    Did you get any errors from the nRF52-DK? If so, what did they read?

    Best regards,
    Karl

Reply
  • Hello,

    In Arduino IDE using Arduino UNO it woks.

    In VScode with the nRF52-DK, the Terminal will show "Could not find a valid BMP280 sensor, check wiring or "
    "try a different address!"

    I am not familiar with the Arduino UNO or how this can be done in Arudino, unfortunately. Could you show me how you attempted to do this in VScode for the nRF52-DK?
    Could you also clarify if you are using the nRF5 SDK, or the NCS SDK? Which version are you working with?
    Did you get any errors from the nRF52-DK? If so, what did they read?

    Best regards,
    Karl

Children
No Data
Related