Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI270 INT1 & INT2 no interrupt on hardware pin

    BMI270 INT1 & INT2 no interrupt on hardware pin

    sos
    New Poster

    I'm using the BMI270 shuttle board. The sensor is set up correctly and I can read data from the accelerometer and gyroscope. I have tested all the code provided on GitHub. All codes are working fine. I received all interrupts on the terminal. But there is no interrupt sense on INT1 & INT2 pin. I have map interrupt provided in the source code. I have copied the source code as it is.

    Please guide me to resolve the issue.

    Thanks in adavanced.

    Regards,

    Suhas

    5 REPLIES 5

    BSTRobin
    Community Moderator
    Community Moderator

    Hello sos,

    Could we know which example code you run and expect to get INT1, INT2 hardware interrupt?

    I am using the Significant motion interrupt. I am using below code:-

    /* Status of api are returned to this variable. */
    int8_t rslt;

    /* Structure to define the type of sensor and its configurations. */
    struct bmi2_sens_config config;

    /* Accel sensor and significant-motion feature are listed in array. */
    uint8_t sens_list[2] = { BMI2_ACCEL, BMI2_SIG_MOTION };

    /* Variable to get significant-motion interrupt status. */
    uint16_t int_status = 0;

    /* Sensor initialization configuration. */
    struct bmi2_dev bmi2_dev;

    /* Select features and their pins to be mapped to. */
    struct bmi2_sens_int_config sens_int = { .type = BMI2_SIG_MOTION, .hw_int_pin = BMI2_INT_BOTH };

    /* Interface reference is given as a parameter
    * For I2C : BMI2_I2C_INTF
    * For SPI : BMI2_SPI_INTF
    */
    rslt = bmi2_interface_init(&bmi2_dev, BMI2_I2C_INTF);
    bmi2_error_codes_print_result(rslt);

    /* Initialize bmi270. */
    rslt = bmi270_init(&bmi2_dev);
    bmi2_error_codes_print_result(rslt);

    if (rslt == BMI2_OK)
    {
    /* Enable the selected sensors. */
    rslt = bmi270_sensor_enable(sens_list, 2, &bmi2_dev);
    bmi2_error_codes_print_result(rslt);

    /* Configure the type of feature. */
    config.type = BMI2_SIG_MOTION;

    if (rslt == BMI2_OK)
    {
    /* Get default configurations for the type of feature selected. */
    rslt = bmi270_get_sensor_config(&config, 1, &bmi2_dev);
    bmi2_error_codes_print_result(rslt);

    if (rslt == BMI2_OK)
    {
    /* Map the feature interrupt for significant-motion. */
    rslt = bmi270_map_feat_int(&sens_int, 1, &bmi2_dev);
    bmi2_error_codes_print_result(rslt);

    /* By default the significant-motion interrupt occurs when the sensor is in motion for about 5 seconds.
    * */
    printf("Move the board for 5 secs in any direction\n");

    do
    {
    /* To get the interrupt status of significant-motion. */
    rslt = bmi2_get_int_status(&int_status, &bmi2_dev);
    bmi2_error_codes_print_result(rslt);

    /* To check the interrupt status of significant-motion. */
    if (int_status & BMI270_SIG_MOT_STATUS_MASK)
    {
    printf("Significant motion interrupt is generated\n");
    //break;
    }
    } while (rslt == BMI2_OK);
    }
    }
    }

    while(1)
    {


    k_msleep(1000);


    }

    BSTRobin
    Community Moderator
    Community Moderator

    Hello sos,

    In you code, it didn't enable INT1, INT2 output with BMI2_INT_OUTPUT_ENABLE.

    You could refer the following code to config INT1, INT2 pins for BMI270.

    struct bmi2_int_pin_config int_cfg;

    bmi2_get_int_pin_config(&int_cfg, dev);

    int_cfg.pin_type = BMI2_INT1;
    int_cfg.pin_cfg[0].lvl = BMI2_INT_ACTIVE_HIGH;/*Config INT1 rising edge trigging*/
    int_cfg.pin_cfg[0].od = BMI2_INT_PUSH_PULL;
    int_cfg.pin_cfg[0].output_en= BMI2_INT_OUTPUT_ENABLE;

    bmi2_set_int_pin_config(&int_cfg, dev);
    bmi2_error_codes_print_result(rslt);

    After you config INT1, INT2 trigging level(rising or falling), you should also config MCU with the same trigging method.

    Hi,

    Thanks for the reply.

    Please provide any link or sample code?

     

     

    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