Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BHI160 no sensor data after first interrupt signal

    BHI160 no sensor data after first interrupt signal

    New Poster



    We're developing board using BHI160B with STM32 MCU.

    My code and firmware is based on the driver and examples.

    Driver :


    We were able to upload and check firmware, then we can read interrupt signal and data once.

    After that, there is no interrupt signal nor data from the sensor.


    We've done some test and found out there's no pullup resistor for aux I2C port, but adding them made no difference.

    It seems there's no signal from aux I2C port at all.


    Here's our test code snippet.

      /* Wait for IMU is powered on. */
      /* put callbacks. */
      bhy_install_meta_event_callback(BHY_META_EVENT_TYPE_INITIALIZED, meta_event_callback);
      bhy_install_meta_event_callback(BHY_META_EVENT_TYPE_SELF_TEST_RESULTS, meta_event_callback);
      /* initialize the bhy chip */
          DEBUG("Fail to init bhy\n");
      /* Wait for IMU interrupt pin triggers. */
      /* Enables a streaming sensor. The goal here is to generate data */
      /* in the fifo, not to read the sensor values. */
      int dbg;
      dbg = bhy_enable_virtual_sensor(VS_TYPE_ROTATION_VECTOR, VS_NON_WAKEUP, FIFO_SAMPLE_RATE, 1000, VS_FLUSH_NONE, 0, 0);
      /* empty the fifo for a first time. the interrupt does not contain sensor data */
      bhy_read_fifo(fifo, FIFO_SIZE, &bytes_read, &bytes_remaining);
      /* Sets the watermark level */
      bhy_set_fifo_water_mark(BHY_FIFO_WATER_MARK_NON_WAKEUP, 800);
      while (1)
          /* Wait until IMU releases interrupt signal. */
          if(Dev_IMU_CheckIntSignal() || bytes_remaining)
              bhy_read_fifo(fifo + bytes_left_in_fifo, FIFO_SIZE - bytes_left_in_fifo, &bytes_read, &bytes_remaining);
              bytes_read += bytes_left_in_fifo;
              fifoptr = fifo;
              packet_type = BHY_DATA_TYPE_PADDING;
                  /* this function will call callbacks that are registered */
                  result = bhy_parse_next_fifo_packet(&fifoptr, &bytes_read, &fifo_packet, &packet_type);
                  /* prints all the debug packets */
                  if (packet_type == BHY_DATA_TYPE_DEBUG)
                      bhy_print_debug_packet(&fifo_packet.data_debug, bhy_printf);
                  /* the logic here is that if doing a partial parsing of the fifo, then we should not parse  */
                  /* the last 18 bytes (max length of a packet) so that we don't try to parse an incomplete   */
                  /* packet */
              } while ((result == BHY_SUCCESS) && (bytes_read > (bytes_remaining ? 18 : 0)));
              bytes_left_in_fifo = 0;
              if (bytes_remaining)
                  /* shifts the remaining bytes to the beginning of the buffer */
                  while (bytes_left_in_fifo < bytes_read)
                      fifo[bytes_left_in_fifo++] = *(fifoptr++);






    3 REPLIES 3

    Community Moderator
    Community Moderator

    Hello MintaeBae,

    You could try to use the way of reading interrupt register.


    int bhi160b_get_int_status()
    uint8_t value;

    bhy_read_reg(BHY_I2C_REG_INT_STATUS_ADDR, &value, 1);

    It does not work.Always reads zero.

    Community Moderator
    Community Moderator

    Hello MintaeBae,

    I setup demo code with BHy1_driver_and_MCU_solution on STM32, it worked well.
    Please refer attached code.