This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Sdk 16 TWI problem

I decided to move to 16 SDK, but I have problems with TWI. Whenever I try to read data from sensor, I get only 0 as the output. I use sensors ICM-20600.

When I try to read data from the accelerometer and gyroscope, I get 0. But on sdk 14.2 these sensors work perfectly

TWI Initialization:

static void twi0_init(void) {
  const nrf_drv_twi_config_t twi_lsm330dlc_config = {
      .scl = SCL0_PIN,
      .sda = SDA0_PIN,
      .frequency = NRF_TWI_FREQ_400K,
      .interrupt_priority = APP_IRQ_PRIORITY_LOWEST,
      .clear_bus_init = true};

  APP_ERROR_CHECK(nrf_drv_twi_init(&m_twi0, &twi_lsm330dlc_config, twi_handler, NULL));

  nrf_drv_twi_enable(&m_twi0);
}

//twi_init
static void twi1_init(void) {
  const nrf_drv_twi_config_t twi_lsm330dlc_config = {
      .scl = SCL1_PIN,
      .sda = SDA1_PIN,
      .frequency = NRF_TWI_FREQ_400K,
      .interrupt_priority = APP_IRQ_PRIORITY_LOWEST,
      .clear_bus_init = true};

  APP_ERROR_CHECK(nrf_drv_twi_init(&m_twi1, &twi_lsm330dlc_config, twi_handler, NULL));

  nrf_drv_twi_enable(&m_twi1);
}

void twi_init(void) {
  twi0_init();
  nrf_delay_ms(100);
  twi1_init();
  nrf_delay_ms(100);
}

Related