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

TWI unresponsive when sending APDS-9306 stop command

Hello,

We are developing a product using a nrf52832 and an APDS-9306 ambient light sensor. This sensor interface using the TWI peripheral. We are using the 14.2.0 SDK and the twi_mngr library.

When writing/reading on most registers on the APDS everything work fine and we can use all functionalities of the sensor. Problems arise when we try to use the reset functionality by writing the corresponding bit (0x10) in the MAIN_CTRL register(0x00). The TWI trigger the STOP event at the end of the frame and the APDS reset, but the TWI become unresponsive to further STARTTX tasks so that the next nrf_twi_mngr_perform is stuck in :

while (cb_data.transaction_in_progress)

The TWI is unresponsive to SUSPEND or RESUME.

We modified the example project twi_master_using_twi_mngr to isolate the problem from the app. Just sending 0x10 to register 0x00 trigger this issue.

When investigating we noticed that the APDS have a strange behavior when triggering reset that does not append on other commands : it release SDA just after the last SCL edge that normally sample ACK/NACK.

One solution we found was to disable/enable the TWI peripheral after this transfer, but we have other devices on this TWI bus and would rather not do this.

Can the TWI stay stuck and could it be because of the weird behavior of the APDS on the SDA line ?

Is there any way to stop/cancel the transfer without disabling the TWI peripheral ?

Related