Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMI270 single data ready interrupt

    Established Member

    BMI270 single data ready interrupt


    I have a problem with data ready interrupt on the BMI270. When my sensor starts I get only the first interrupt, then it seems that the sensor stops firing interrupts.
    The BMI270 is connected to a STM32F072 over SPI.

    I read the data using SPI with DMA:



    void reqBMIDataDMA(uint8_t getTemp) {
    	static int errCount = 0;
    	uint8_t reg_addr[BMI_BUFF_SIZE] = { (BMI2_STATUS_ADDR | BMI2_SPI_RD_MASK) };
    	uint16_t dataSize = BMI_BUFF_SIZE;
    	// Select BMI270
    	HAL_StatusTypeDef res = HAL_SPI_TransmitReceive_DMA(hspi_bmi, reg_addr, bmi_buffer, dataSize);
    	if (res != HAL_OK)



    The burst read includes the INT_STATUS_1 register, so the interrupt flag should be automatically cleared...

    This is the configuration for the interrupt pin:



    	// Interrupt PINs configuration
    	struct bmi2_int_pin_config data_int_cfg;
    	data_int_cfg.pin_type = BMI2_INT1;
    	data_int_cfg.int_latch = BMI2_INT_NON_LATCH;
    	data_int_cfg.pin_cfg[0].output_en = BMI2_INT_OUTPUT_ENABLE; // Output enabled
    	data_int_cfg.pin_cfg[0].od = BMI2_INT_PUSH_PULL;			// OpenDrain disabled
    	data_int_cfg.pin_cfg[0].lvl = BMI2_INT_ACTIVE_LOW;			// Signal Low Active
    	data_int_cfg.pin_cfg[0].input_en = BMI2_INT_INPUT_DISABLE;	// Input Disabled
    	rslt =  bmi2_set_int_pin_config( &data_int_cfg, &bmi270_dev);
    	if (rslt != BMI2_OK)
    		goto exit;
    	// Map data interrupt
    	rslt = bmi2_map_data_int( BMI2_GYRO, BMI2_INT1, &bmi270_dev);
    	if (rslt != BMI2_OK)
    		goto exit;



    And this isthe  GPIO configuration MCU side:



      /*Configure GPIO pins : PBPin PBPin */
      GPIO_InitStruct.Pin = IMU_INT1_Pin|IMU_INT2_Pin;
      GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
      GPIO_InitStruct.Pull = GPIO_NOPULL;
      HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
      /* EXTI interrupt init*/
      HAL_NVIC_SetPriority(EXTI4_15_IRQn, 3, 0);




    Thank you for helping

    4 REPLIES 4
    Established Member

    Re: BMI270 single data ready interrupt

    I suggest you connect the BMI270 INT pin to an oscilloscope to determine the actual data ready interrupt behaviour. It is not clear from your description if the issue is that the BMI270 is not asserting the interrupt or if the host not detecting the interrupt.

    Established Member

    Re: BMI270 single data ready interrupt

    Hi sebmadgwick,

    the MCU should be correctly configured because I can receive interrupts from a BMI160 using the same parameters.
    I'm trying to understand if I'm doing it right with the BMI270 and I don't know if I'm missing something in the sensor configuration or if the parameters are wrong.

    The documentation is lacking and the no one example is about configuring interrupt features.


    Established Member

    Re: BMI270 single data ready interrupt

    I found the problem in my initialization code.
    The `data_int` parameter of the `bmi2_map_data_int` function must be `BMI2_DRDY_INT` to enable the data ready interrupt:

    	// Map data interrupt
    	rslt = bmi2_map_data_int( BMI2_DRDY_INT, BMI2_INT1, &bmi270_dev);
    	if (rslt != BMI2_OK)
    		goto exit;



    Re: BMI270 single data ready interrupt

    Thanks for the feedback Myzhar!


    In case other members find themselves in a similar issue, always look at the comment block directly in the code of the sensor API. It *should* always include a description when specific values are required.


    In this case:

     * @brief This API maps/un-maps data interrupts to that of interrupt pins.
     * @param[in] int_pin      : Interrupt pin selected.
     * @param[in] data_int     : Type of data interrupt to be mapped.
     * @param[in] dev          : Structure instance of bmi2_dev.
     * data_int             |  Mask values
     * ---------------------|---------------------
     * BMI2_FFULL_INT       |  0x01
     * BMI2_FWM_INT         |  0x02
     * BMI2_DRDY_INT        |  0x04
     * BMI2_ERR_INT         |  0x08
     * @return Result of API execution status
     * @retval BMI2_OK - Success.
     * @retval BMI2_E_NULL_PTR - Error: Null pointer error
     * @retval BMI2_E_COM_FAIL - Error: Communication fail
     * @retval BMI2_E_INVALID_INT_PIN -  Error: Invalid interrupt pin
    int8_t bmi2_map_data_int(uint8_t data_int, enum bmi2_hw_int_pin int_pin, struct bmi2_dev *dev);


    The BMI2_GYRO definition is actually 0x01, which is FIFO full interrupt in this context.