Skip to content

Commit d3e8d6c

Browse files
pabigotnashif
authored andcommitted
i2c_shell: restore documentation on scan technique
When this code was moved from a standalone sample to an optional shell feature the documentation on how this works and caveats was lost. Put it back so it can be referenced in issue explanations. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
1 parent e997c46 commit d3e8d6c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/i2c/i2c_shell.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ LOG_MODULE_REGISTER(i2c_shell, CONFIG_LOG_DEFAULT_LEVEL);
1919
/* Maximum bytes we can write or read at once */
2020
#define MAX_I2C_BYTES 16
2121

22+
/*
23+
* This sends I2C messages without any data (i.e. stop condition after
24+
* sending just the address). If there is an ACK for the address, it
25+
* is assumed there is a device present.
26+
*
27+
* WARNING: As there is no standard I2C detection command, this code
28+
* uses arbitrary SMBus commands (namely SMBus quick write and SMBus
29+
* receive byte) to probe for devices. This operation can confuse
30+
* your I2C bus, cause data loss, and is known to corrupt the Atmel
31+
* AT24RF08 EEPROM found on many IBM Thinkpad laptops.
32+
*
33+
* https://manpages.debian.org/buster/i2c-tools/i2cdetect.8.en.html
34+
*/
2235
static int cmd_i2c_scan(const struct shell *shell,
2336
size_t argc, char **argv)
2437
{

0 commit comments

Comments
 (0)