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
  • Hi,

    Can you elaborate on what happens when the device stops working? Do you get incorrect data, no data at all, any error codes from function calls, etc?

    Have you checked the I2C/TWI bus with a logic analyzer, to see if the commands are sent and received correctly?

    nrf_drv_twi_uinit() is not a function in the SDK, have you implemented this yourself? What does it do? Why is this declared as extern?

    The correct function to use should be "nrf_drv_twi_uninit()".

    Best regard,
    Jørgen

Reply
  • Hi,

    Can you elaborate on what happens when the device stops working? Do you get incorrect data, no data at all, any error codes from function calls, etc?

    Have you checked the I2C/TWI bus with a logic analyzer, to see if the commands are sent and received correctly?

    nrf_drv_twi_uinit() is not a function in the SDK, have you implemented this yourself? What does it do? Why is this declared as extern?

    The correct function to use should be "nrf_drv_twi_uninit()".

    Best regard,
    Jørgen

Children
Related