Hi everyone,
I'm working on a project using the Bosch BMI160 IMU with an Arduino Uno over SPI (3.3V logic, 1 MHz, MSBFIRST, SPI_MODE3). I'm using the Bosch BMI160 API from the COINES software package to initialize the sensor, but bmi160_init() consistently returns BMI160_E_DEV_NOT_FOUND.
Setup Details:
Wiring:
- CS: Arduino Pin 10
- SCK: Pin 13
- MISO: Pin 12
- MOSI: Pin 11
- VDD/VDDIO: 3.3V
- GND: Connected
SPI Settings: 1 MHz, MSBFIRST, SPI_MODE3 (as per BMI160 datasheet)
Library: Bosch BMI160 API (COINES)
Code Snippet (simplified):
<span>#include "bmi160.h"
struct bmi160_dev sensor;
void setup() {
SPI.begin();
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
sensor.intf = BMI160_SPI_INTF;
sensor.read = user_spi_read;
sensor.write = user_spi_write;
sensor.delay_ms = delay;
int8_t rslt = bmi160_init(&sensor);
Serial.println(rslt); // Returns -1 (BMI160_E_DEV_NOT_FOUND)
}</span>
The sensor doesn't seem to respond during initialization. I've double-checked the wiring with a multimeter, and the 3.3V supply is stable. I suspect it might be related to SPI communication or chip select (CS) handling.
Any insights or suggestions would be greatly appreciated! I can share more code or wiring details if needed. Thanks in advance!