The twi master driver BNO085 obtains invalid data for a period of time

TWI Master drives BNO085 to read four-element data at intervals of 20ms, and I2C will not be able to read data when the device works for more than 10 minutes. INITTWI and reinitializing BNO085 still can't get the correct data, only resetting NRF52832 can continue to run normally, is there any way to solve the problem of probabilistic inability to get data, or how to make it continue to work by reinitializing TWIs, thank you
and blow is the code Reinit the twi drvier

twi_unint();
nrf_delay_ms(100);
hal_bno085_init();



void hal_bno085_init(void)
{

twi_init();
imu_gpio_init();
softReset();
NRF_LOG_INFO("soft reset end");
NRF_LOG_FLUSH();
sensor_check();
NRF_LOG_INFO("sensor check");
NRF_LOG_FLUSH();


enableRotationVector(SENSOR_REPORTID_AR_VR_STABILIZED_ROTATION_VECTOR,20);
enableRotationVector(SENSOR_REPORTID_LINEAR_ACCELERATION,50);
}

Parents
  • addition some code below:

    void twi_init (void)
    {
        ret_code_t err_code;
    
        const nrf_drv_twi_config_t twi_bno085_config = {
           .scl                = ARDUINO_SCL_PIN,
           .sda                = ARDUINO_SDA_PIN,
           .frequency          = NRF_DRV_TWI_FREQ_400K,
           .interrupt_priority = APP_IRQ_PRIORITY_MID,
           .clear_bus_init     = false
        };
    
        err_code = nrf_drv_twi_init(&m_twi, &twi_bno085_config, twi_handler, NULL);
        APP_ERROR_CHECK(err_code);
    
        nrf_drv_twi_enable(&m_twi);
    }
    
    extern void nrf_drv_twi_uinit(nrf_drv_twi_t const *        p_instance);
    void twi_unint(void)
    {
    	nrf_drv_twi_disable(&m_twi);
    	nrf_drv_twi_uinit(&m_twi);
    }

Reply
  • addition some code below:

    void twi_init (void)
    {
        ret_code_t err_code;
    
        const nrf_drv_twi_config_t twi_bno085_config = {
           .scl                = ARDUINO_SCL_PIN,
           .sda                = ARDUINO_SDA_PIN,
           .frequency          = NRF_DRV_TWI_FREQ_400K,
           .interrupt_priority = APP_IRQ_PRIORITY_MID,
           .clear_bus_init     = false
        };
    
        err_code = nrf_drv_twi_init(&m_twi, &twi_bno085_config, twi_handler, NULL);
        APP_ERROR_CHECK(err_code);
    
        nrf_drv_twi_enable(&m_twi);
    }
    
    extern void nrf_drv_twi_uinit(nrf_drv_twi_t const *        p_instance);
    void twi_unint(void)
    {
    	nrf_drv_twi_disable(&m_twi);
    	nrf_drv_twi_uinit(&m_twi);
    }

Children
No Data
Related