Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    bmi2.c v/s bmi270.c in BMI270_API

    bmi2.c v/s bmi270.c in BMI270_API

    punitjain8695
    Member

    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:

    bmi2_get_gyro_cross_sense
    bmi2_sec_init

    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. 

    Thanks, 

    Hi,

    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): https://e2e.ti.com/support/microcontrollers/other/f/other-microcontrollers-forum/430818/launchpad-s-...

    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

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist