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?
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?
Hi,
Some I2C slaves lets you select one of a few addresses by hooking some pin(s) to VDD or ground, so that could be the case. Which sensor are you using?
I'm using SDP31 pressure sensor. Its datasheet is here.
According to page 4, section 3.3, my ADDR connects to GND. So its I2C address should be 0x21. But <TWI scanner> demo shows that the address is 0x20.
Thanks, Einar!
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?
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?