i2cdump
Dump I2C device registers
TLDR
Dump all registers of an I2C device
Dump all registers of an I2C device without asking for confirmation
Dump all registers of an I2C device using a specific mode
Dump registers from start to end of an I2C device
SYNOPSIS
i2cdump [-y] [-f] [-r first-last] [-V] [-l] [-u] i2c-bus address [mode]
PARAMETERS
i2c-bus
The I2C bus number or name to scan (e.g., 0, 1, /dev/i2c-0).
address
The 7-bit hexadecimal address of the I2C device on the bus.
mode
The dump mode. Options include:
b: Read individual bytes (default).
w: Read 16-bit words.
s: Read SMBus blocks.
i: Read generic I2C blocks.
c: Read entire chip memory (potentially dangerous).
-y
Disable interactive mode. Assume 'yes' for all prompts, which can be dangerous for certain operations.
-f
Force access to the I2C bus. Useful when the kernel thinks another driver is using the bus, but use with caution.
-r first-last
Specify a range of registers to dump (e.g., 0x00-0x1F).
-V
Display the version information and exit.
-l
List all supported dump modes and exit.
-u
Do not print empty lines in the output, making the display more compact.
DESCRIPTION
i2cdump is a powerful command-line utility from the i2c-tools package used for examining the contents of registers on an I2C/SMBus device. It allows users to read and display data directly from an I2C chip's memory or registers at a specified address on a given I2C bus.
This tool is invaluable for embedded systems developers and hardware engineers for debugging I2C device drivers, verifying hardware functionality, or reverse-engineering unknown I2C devices. It supports various dump modes, including byte-level, word-level, SMBus block reads, and more generic I2C reads, providing flexibility based on the device's communication protocol.
While highly useful, i2cdump interacts directly with hardware, making it a potentially dangerous tool if misused. Proper care and understanding of the target device's datasheet are essential to avoid unintended side effects or hardware damage.
CAVEATS
Hardware Interaction: i2cdump directly interacts with I2C hardware. Incorrect usage, especially with the -f (force) or -c (chip dump) options, can lead to unpredictable device behavior, data corruption, or even permanent hardware damage.
Permissions: Accessing I2C devices typically requires root privileges (e.g., using sudo) to access the /dev/i2c-* devices.
Bus Contention: If other kernel modules or applications are actively using the I2C bus, forcing access with -f can lead to bus contention, potentially disrupting ongoing communications or causing system instability.
<B>USAGE EXAMPLES</B>
To dump the first 32 bytes of device at address 0x50 on bus 1 (default byte mode):sudo i2cdump 1 0x50
To dump specific registers (0x10 to 0x1F) in word mode on bus 0, address 0x22:sudo i2cdump -r 0x10-0x1F 0 0x22 w
To list all supported dump modes:i2cdump -l
HISTORY
i2cdump is a core utility within the i2c-tools suite, a collection of userspace programs for communicating with I2C/SMBus devices. Developed initially by Frodo Looijaard and later maintained by Jean Delvare, i2c-tools has been a staple in Linux kernel development and embedded systems debugging for many years. i2cdump's role has consistently been to provide a low-level view into I2C device registers, evolving with the I2C kernel subsystem to support various bus types and communication modes.