This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BMX160 not working correctly over SPI.

I am trying to get a BMX160 working over SPI. I was following this post  to make this code using the SPI example from the SDK as a basis. I am using SDK 15.3 with a nRF52840 in SES.

Below is my code

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "nrf_drv_spi.h"
#include "app_util_platform.h"
#include "nrf_gpio.h"
#include "nrf_delay.h"
#include "boards.h"
#include "app_error.h"
#include <string.h>
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "bmi160.h"
#include "bmi160_defs.h"
#define SPI_INSTANCE 0 /**< SPI instance index. */
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /**< SPI instance. */
static volatile bool spi_xfer_done; /**< Flag used to indicate that SPI instance completed the transfer. */
struct bmi160_dev sensor;
static uint8_t filler= 0xFF;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

And below is my output in the console.

I am not sure if I have made and error in my code to cause a test fail and not give me any outputs for the chip id.

I have also used this post on Bosch's forum as a reference for difference between BMI160 and BMX160. 

Is there anything in my code that could be causing an error that I can fix?