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

BMI160 + NRF52832 + I2C

HI,

I want to develop a program to access Accelerometer and gyroscope value from BMI160 sensor. I have used this BMI160 library 

I alter the TWI_SENSOR code and it works for self testing ACC code. but i need to calibrate the x, y, z axis value and i want to add BLE stack to read in mobile app.

1. How to collect all the X,Y,Z axis value

2. i need to see the LOGS in Bluetooth app by using BLE_UART. how to edit the BLE_UART code to get the respective ACC and GYRO value in BLE APP.

Is there any code for reading X,Y,Z axis for BMI160??

Parents Reply Children
  • HI Jorgen

    Nice to meet you,

    Well i use the guide in that each code they use rslt . which returns zero (0)  after each function. it means it work properly but i can't get the required Acc X data.

    Once i get the required data in NRF_LOG then i switch it to BLE_UART

  • Then you need to post the code you have implemented in order for us to help your any further.

    You need to implement the SPI/TWI read/write functions for the library to work. It is just a general library and does not know how to interface with peripherals of nRF5x ICs.

  • Here is my first code that with rslt data

    by default  in bmi160_defs.h

    BMI160_I2c_ADDR  -  0x68

    but i changed to 0x69 after scan the address by using TWI sacnner code.

    as a result got

    <info> app: BMI160 get started.

    <info> app: sensor is :0

    <info> app: rslt is :0

    <info> app: rslt is :0

    <info> app: Acc is :0

    <info> app: gyro is :0

    <info> app: Acc is :0

    <info> app: Acc is :0

    <info> app: Acc is :0

    <info> app: Acc is :0

    <info> app: Acc is :0

    <info> app:
     ACCEL SELF TEST RESULT SUCCESS

    Is rslt shows error return code or any. i didn't understood the exact function of RSLT in code.

  • rslt is the return code from the function call. The received data is stored in parameter 'struct bmi160_sensor_data *accel'

  • HI,

    I am trying to get the Accel X value and gyro X value but the rslt is 0 and data also 0.