![]() |
nrfx 4.5.0
|
The sample demonstrates a functionality of nrfx_twim and nrfx_twis drivers, when TWI transfer is performed in the TX-RX mode.
The sample supports the following development kits:
| Board | Support |
|---|---|
| nrf52dk_nrf52832 | Yes |
| nrf52833dk_nrf52833 | Yes |
| nrf52840dk_nrf52840 | Yes |
| nrf5340dk_nrf5340 | Yes |
| nrf54l15dk_nrf54l15 | Yes |
| nrf9160dk_nrf9160 | Yes |
Application initializes nrfx_twim and nrfx_twis drivers. The main purpose of this sample is to emulate a situation, in which you read data from particular registers of the slave (usual sensor -> controller communication using two wire interface). The sample works as a simple simulation in which you can communicate with a drone by reading the values from its individual registers.
m_drone_reg is used as an internal register map of the drone. In the first operation, which is the write operation (TX), define a register number from which the data will be read in the read operation (RX).twim_handler() is executed with relevant log messages.twis_handler() is used to prepare data for receiving and sending.register_read() function is used to write data from particular registers to buffer in master device and print content of that buffer.For more information, see TWIM driver and TWIS driver - nrfx documentation.
To run the sample correctly, connect pins as follows:
LOOPBACK_PIN_1A with LOOPBACK_PIN_1BLOOPBACK_PIN_2A with LOOPBACK_PIN_2BRefer to pin definitions in
common/nrfx_example.h.
You should monitor the output from the board to check if it is as expected.
To run this sample, build it for the appropriate board and then flash it as per instructions in Building and running section.
You should see the following output: