Hello all, I am trying to migrate my project from BMI160 to BMI270 but so far I am unable to initialise the device. I began with some code which works for BMI160 (ATSAM M0+, Atmel studio) and am trying to migrate using the reference API :https://github.com/BoschSensortec/BMI270-Sensor-API. Hopefully someone can help point me in the right direction. 1) Firstly I should point out that SPI communication works with BMI270 using my user spi read/write functions directly: static uint8_t read_test_buff[2] = {0, 0}; static uint8_t write_test_buff[2] = {0x11, 0x12}; // some random data static uint8_t read_test_buff2[2] = {0, 0, 0}; // READ TEST // user_spi_read(0, BMI2_CHIP_ID_ADDR, read_test_buff, 2); //updates as expected: read_test_buff = {0, 0x24, 0}; // SUCCESS // WRITE TEST // user_spi_write(0, BMI2_ACC_OFF_COMP_0_ADDR, write_test_buff, 2); // write to accelerometer offset x & y registers user_spi_read(0, BMI2_ACC_OFF_COMP_0_ADDR, read_test_buff2, 3); // read accelerometer offset x & y registers //updates as expected: read_test_buff2 = {0, 0x11, 0x12}; // SUCCESS QUESTION: Is this output format correct? Or should I be getting something like read_test_buff={0x24, 0} and read_test_buff2={ 0x23, 0x24, 0}, or something else ? 2) Here's my code to initialise the sensor: struct bmi2_dev bmi270_dev; int8_t BMI270_sensor_init(void) { int8_t rslt = BMI2_OK; // Set SPI interface parameters bmi270_dev.chip_id = BMI270_CHIP_ID; // also tried chip_id =0 bmi270_dev.dummy_byte = 1; bmi270_dev.read_write_len = 32; // also tried read_write_len= 8192 as in github arduino gist bmi270_dev.intf = BMI2_SPI_INTF; bmi270_dev.read = user_spi_read; bmi270_dev.write = user_spi_write; bmi270_dev.delay_us = user_delay_us; bmi270_dev.config_file_ptr = NULL; rslt = bmi270_init(&bmi270_dev); return rslt; } Whilst debugging I have followed initiation through to bmi2_soft_reset(...). More specifically to the line: /* Reset bmi2 device */ rslt = bmi2_set_regs(BMI2_CMD_REG_ADDR, &data, 1, dev); This calls 'user_spi_write', however it throws an error. There seems to be a similar issue when bmi2_get_regs(...) is called. (rslt = BMI2_E_COM_FAIL). Any help would be much appreciated!
... View more