I wasn't able to find sample code showing how to use the nrfx sdk to perform TWI slave.
Can you point me to some examples ?
I wasn't able to find sample code showing how to use the nrfx sdk to perform TWI slave.
Can you point me to some examples ?
Hi,
Do you mean nRF5 SDK? nrfx is the separate driver package, which is used both in nRF5 SDK and nRF Connect SDK (NCS).
TWI Slave example is available in the SDK. The example is using the legacy driver APIs, but if you want to use nrfx APIs you can follow the migration guide.
Best regards,
Jørgen.
I can't find a clear procedure to do this in the driver or in the peripheral documentation. You will have to handle this in the application, but since the TWIS peripheral use EasyDMA to read/write directly from/to RAM, there is no way to intercept the transfer between the register-address being written and the ACK being generated. You can stop a read operation if the slave does not support the register-address after the address-write, by stopping the peripheral, using the following function:
nrf_twis_task_trigger(m_twis.p_reg,NRF_TWIS_TASK_STOP);
Note that this does not prevent the master from performing the read, the master will have to detect and react to the NACKs and stop the transfer itself. This is a capture I did with the TWIS example:
I can't find a clear procedure to do this in the driver or in the peripheral documentation. You will have to handle this in the application, but since the TWIS peripheral use EasyDMA to read/write directly from/to RAM, there is no way to intercept the transfer between the register-address being written and the ACK being generated. You can stop a read operation if the slave does not support the register-address after the address-write, by stopping the peripheral, using the following function:
nrf_twis_task_trigger(m_twis.p_reg,NRF_TWIS_TASK_STOP);
Note that this does not prevent the master from performing the read, the master will have to detect and react to the NACKs and stop the transfer itself. This is a capture I did with the TWIS example: