help! trouble using SparkFun BMI270 Arduino Library Example01

I want to run the SparkFun BMI270 Arduino Library Example01 to get acceleration and rotational data, with the BMI270 connected to my Arduino nano Every. But I am only getting the ‘BMI270 is not connected’ error. When I run a I2C scanner code, the I2C address is shown as 0x68.

If the I2C scanner can pick it up, it means the BMI270 is connected, right? Is this a problem of the code or the hardware setup?

hardware setup: the SCL, SDA, 3V3, GND on the BMI270 are connected to the Arduino nano Every’s A5(SCL), A4(SDA), 3v3 and GND respectively.

code obtained from: https://docs.sparkfun.com/SparkFun_Qwii … examples/

(Example 1: Basic Readings, the first example on the page)

The Arduino code is copied here:

#include <Wire.h>

#include “SparkFun_BMI270_Arduino_Library.h”

// Create a new sensor object

BMI270 imu;

// I2C address selection

uint8_t i2cAddress = 0x68; // 0x68

//uint8_t i2cAddress = BMI2_I2C_SEC_ADDR; // 0x69

void setup()

{

// Start serial

Serial.begin(115200);

Serial.println(“BMI270 Example 1 - Basic Readings I2C”);

// Initialize the I2C library

Wire.begin();

// Check if sensor is connected and initialize

// Address is optional (defaults to 0x68)

while (imu.beginI2C(i2cAddress) != BMI2_OK)

{

// Not connected, inform user

Serial.println(“Error: BMI270 not connected, check wiring and I2C address!”);

// Wait a bit to see if connection is established

delay(1000);

}

Serial.println(“BMI270 connected!”);

}

void loop()

{

// Get measurements from the sensor. This must be called before accessing

// the sensor data, otherwise it will never update

imu.getSensorData();

// Print acceleration data

Serial.print(“Acceleration in g’s”);

Serial.print(“\t”);

Serial.print("X: ");

Serial.print(imu.data.accelX, 3);

Serial.print(“\t”);

Serial.print("Y: ");

Serial.print(imu.data.accelY, 3);

Serial.print(“\t”);

Serial.print("Z: ");

Serial.print(imu.data.accelZ, 3);

Serial.print(“\t”);

// Print rotation data

Serial.print(“Rotation in deg/sec”);

Serial.print(“\t”);

Serial.print("X: ");

Serial.print(imu.data.gyroX, 3);

Serial.print(“\t”);

Serial.print("Y: ");

Serial.print(imu.data.gyroY, 3);

Serial.print(“\t”);

Serial.print("Z: ");

Serial.println(imu.data.gyroZ, 3);

// Print 50x per second

delay(20);

}