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

TWI Scanner I2C address is 1 bit wrong

I'm using <TWI Scanner> example on nRF52 DK to find my sensor's address.

According to the sensor datasheet, the sensor's address is 0x21. However, <TWI Scanner> finds the address at 0x20. 

Any idea, please? 

Parents Reply Children
  • Then I am out of ideas. The whole TWI Scanner example is essentially just this for loop:

        for (address = 1; address <= TWI_ADDRESSES; address++)
        {
            err_code = nrf_drv_twi_rx(&m_twi, address, &sample_data, sizeof(sample_data));
            if (err_code == NRF_SUCCESS)
            {
                detected_device = true;
                NRF_LOG_INFO("TWI device detected at address 0x%x.", address);
            }
            NRF_LOG_FLUSH();
        }

    As you can see, it prints the address (loop iteration #) of any device it is able to read from. It should not fail... If this is still a problem, perhaps you can use a logic analyzer to see how this looks on the TWI bus?

Related