This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SDK 17 nrf_drv_twi problem

I'm working with the project based on nrf52833 and SDK 17. I've noticed that when there are no devices on I2C bus, the application stucks on nrf_drv_twi_tx function, and the device resets probably because of WDT. Shouldn't the function return timeout?
  • Hello,

    There is no timeout built in the hardware or driver, so this must be handled by the application if this is the case. That said though, I have a "hunch" that you are also missing the pull-up resistors here, which will be interpret as a "clock streching", which is a wait state on the twi bus, and thereby it will not return the NACK that should occur when there are no devices on the bus. So make sure that there are pull up resistors.

    Kenneth

  • In the setup there is a sensor on the I2C bus, but what we do is to enable/disable VDD to the sensor and when it's disabled, the described problem happens

  • You connect VDD of the sensor to a VDD pin on the nRF52-DK, and GND of the sensor to GND on the DK. You can find several pins are labeled VDD and GND. If you worry that there is no sensor attached then you can for instance read the TWI pins first to check if they are high or low. If they are low then it means sensor is not attached, so executing a twi transfer is not a good idea.

    Kenneth

Related