The TWI Scanner Example allows to scan the TWI bus in order to look for connected TWI devices. You can use it to find the address of a single device or to count the devices connected to the nRF board.
The application read sample data on all of possible TWI addresses and waits for a response. Based on the response, the application decides if there is a TWI device connected to the nRF board with a given address.
You can find the source code and the project file of the example in the following folder:
<InstallFolder>\examples\peripheral\twi_scanner
Testing
Test the TWI Scanner Example application by performing the following steps:
- Compile and program the application.
-
Start a terminal emulator like PuTTY and connect to the used COM port with the following UART settings:
- Baud rate: 115.200
- 8 data bits
- 1 stop bit
- No parity
- HW flow control: None
- Observe the logs from the application.
It is recommended to set the flag clear_bus_init during initialization, to make sure that the device is not stuck due to a break during a previous transmission, and that it will send a response.