Dear All,
I want to use Nicla Vision's broken out SPI interface on PE_11-PE_14 for sensor communication, but Nicla Vision cannot detect the sensor BME-280.
PE_11 is CS, PE_12=SCLK, PE_13=CIPO=MISO=SDO of BME280, PE_14=COPI=MOSI=SDA of BME280. These are conveniently levelshifted to 3.3V on the Nicla Vision board.
I use a generic GY-BME280 sensor board for 3.3V in SPI mode.
I run this minimalistic code, but it cannot detect the BME-280 sensor on Nicla Vision:
#include <SPI.h>
#include <Adafruit_BME280.h>
// Define Chip Select pin for BME280:
#define BME_CS PE_11//PE_11 for NiclaV//53 for Mega2560
//Adafruit_BME280 bme;
Adafruit_BME280 bme(BME_CS); // hardware SPI
void setup() {
Serial.begin(115200);
while (!Serial); // Wait for Serial to initialize
SPI.begin();
unsigned status = bme.begin();
if (!status) {
Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!");
while (1) delay(10); // endless loop
}
}
void loop() {
// Read temperature and print it
float temperature = bme.readTemperature();
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" C");
delay(1000); // Wait 1 second before next read
}
If I run the same code on my Mega2560 (with CS=53), it detects the BME correctly.
Would somebody please point me in the right direction? Much appreciated!
Alf