Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    bmi2.c v/s bmi270.c in BMI270_API

    bmi2.c v/s bmi270.c in BMI270_API


    I'm interfacing the BMI270 shuttle board with TI's TM4C1294NCPDT based evaluation board. It's a 32-bit arm-based microcontroller.

    I'm trying to use BMI270_API.

    I've read the value at register address 0x00. it is 0x24. This was done using the bmi2_ois.c file, using the function:

    int8_t bmi2_ois_get_regs(uint8_t ois_reg_addr, uint8_t *ois_reg_data, uint16_t data_len, struct bmi2_ois_dev *ois_dev)

    Now, I was going ahead with initializing the sensor so that I can get to my target of reading acceleration and gyro values. For this, I understand (as of now), that I have to use the function defined in bmi270.c:

    int8_t bmi270_init(struct bmi2_dev *dev)


    This requires two variations, first is, the dev structure is different, which I have defined separately. and another, inclusion of the bmi270.c file during the compilation.

    This throws error of declaration being incompatible for

    static int8_t null_ptr_check(const struct bmi2_ois_dev *ois_dev);  in bmi2_ois.c

    and static int8_t null_ptr_check(const struct bmi2_dev *dev); in bmi270.c

    which is obvious since both of these work on different dev structures of different kinds.

    I then tried the following:

    I removed the bmi2_ois.c from the compilation includes which results in the errors for unresolved symbols for these:


    Again, I tried to include bmi270.c and bmi2.c, which results in multiple definitions of several functions.

    Am I doing something incorrectly? What is the proper procedure to do this?


    11 REPLIES 11

    Hello punitjain8695, 


    Fault_ISR is interrupt handler issue, not our API issue I guess. 

    If you want to read accel and gyro both please do as below. 

    struct bmi2_sensor_data sensor_data[2] = { 0, };

    sensor_data[0].type = BMI2_ACCEL;
    sensor_data[1].type = BMI2_GYRO;
    bmi2_get_sensor_data(sensor_data, 2, &bmi2);

    And you don't need to convert all if you don't need. 



    Really thanks for all the help you've been. I'm sure I'll need more help on the way, but this seems to be working now.


    I played around with the code a lot in the past couple of days and then searched about this kind of weird behavior (Code getting stuck at a position that it was able to run through, with the only difference being that there is a little more code or little more variable declarations. )

    I found out that it was due to the very heavy hierarchy of functions being present in the BMI270_API and a relatively small stack space (512 bytes) being allocated.

    Both of these combined, basically resulted in stack overflow, which then resulted in Fault_ISR being called.

    a reference link (TI's E2E forum):

    I increased the stack space to 1024 bytes from 512 bytes, and the program runs fine. The conversion has some issues, but I was not interested in the conversion anyway.


    Again, lots of thanks for helping me through this. I've left the link for the reference above, just in case someone else has similar issues again in the future.

    Thanks and Regards,

    Punit Jain