1I2CSET(8)                   System Manager's Manual                  I2CSET(8)
2
3
4

NAME

6       i2cset - set I2C registers
7
8

SYNOPSIS

10       i2cset  [-f]  [-y] [-m mask] [-r] [-a] i2cbus chip-address data-address
11       [value] ...  [mode]
12       i2cset -V
13
14

DESCRIPTION

16       i2cset is a small helper program to set registers visible  through  the
17       I2C bus.
18
19

OPTIONS

21       -V     Display the version and exit.
22
23       -f     Force  access  to  the device even if it is already busy. By de‐
24              fault, i2cset will refuse to access a device  which  is  already
25              under the control of a kernel driver. Using this flag is danger‐
26              ous, it can seriously confuse the kernel driver in question.  It
27              can  also  cause i2cset to silently write to the wrong register.
28              So use at your own risk and only if you know what you're doing.
29
30       -y     Disable interactive mode. By default, i2cset  will  wait  for  a
31              confirmation from the user before messing with the I2C bus. When
32              this flag is used, it will perform the operation directly.  This
33              is mainly meant to be used in scripts.
34
35       -m mask
36              The  mask parameter, if specified, describes which bits of value
37              will be actually written to data-address. Bits set to 1  in  the
38              mask are taken from value, while bits set to 0 will be read from
39              data-address and thus preserved by the  operation.  Please  note
40              that  this  parameter assumes that the read and write operations
41              for the specified mode are symmetrical for the  device  you  are
42              accessing.  This  may or may not be the case, as neither I2C nor
43              SMBus guarantees this.
44
45       -r     Read back the value right after writing it, and compare the  re‐
46              sult  with the value written. This used to be the default behav‐
47              ior. The same limitations apply as those of option -m.
48
49       -a     Allow using addresses between 0x00 - 0x07 and 0x78 -  0x7f.  Not
50              recommended.
51
52       There are three required options to i2cset. i2cbus indicates the number
53       or name of the I2C bus to be scanned.  This number should correspond to
54       one  of  the  busses listed by i2cdetect -l. chip-address specifies the
55       address of the chip on that bus, and is an  integer  between  0x08  and
56       0x77.  data-address specifies the address on that chip to write to, and
57       is an integer between 0x00 and 0xFF.
58
59       The value parameter, if specified, is the value to write to that  loca‐
60       tion  on  the chip. If this parameter is omitted, then a short write is
61       issued. For most chips, it simply sets an internal pointer to the  tar‐
62       get  location,  but  doesn't actually write to that location. For a few
63       chips though, in particular simple ones with a  single  register,  this
64       short write is an actual write. If the mode parameter is s or i, multi‐
65       ple values can be specified.
66
67       The mode parameter, if specified, is one of the letters b, w, s, or  i,
68       corresponding  to a write size of a single byte, a 16-bit word, a SMBus
69       block write, or an I2C block write, respectively.  For  SMBus  and  I2C
70       block  writes,  the write size is determined by the number of value pa‐
71       rameters.  Except for I2C block writes, a p can also be appended to the
72       mode parameter to enable PEC.  If the mode parameter is omitted, i2cset
73       defaults to byte mode without PEC. The value provided  must  be  within
74       range for the specified data type (0x00-0xFF for byte and block writes,
75       0x0000-0xFFFF for words).  Another possible mode is  c,  which  doesn't
76       write  any  value  (so-called  short  write). You usually don't have to
77       specify this mode, as it is the default when no value is provided,  un‐
78       less you also want to enable PEC.
79
80

WARNING

82       i2cset  can  be  extremely dangerous if used improperly. It can confuse
83       your I2C bus, cause data loss, or have more serious side effects. Writ‐
84       ing  to  a  serial EEPROM on a memory DIMM (chip addresses between 0x50
85       and 0x57) may DESTROY your memory, leaving your system unbootable!   Be
86       extremely careful using this program.
87
88

EXAMPLES

90       Write  value 0x42 to 8-bit register 0x11 of the I2C device at 7-bit ad‐
91       dress 0x2d on bus 1 (i2c-1), after user confirmation:
92              # i2cset 1 0x2d 0x11 0x42
93
94       Immediately clear the 3 least significant bits of 8-bit  register  0x11
95       of  the I2C device at 7-bit address 0x2d on bus 1 (i2c-1) (no user con‐
96       firmation):
97              # i2cset -y -m 0x07 1 0x2d 0x11 0x00
98
99       Write value 0x5000 to 16-bit register 0x02 of the I2C device  at  7-bit
100       address 0x48 on bus 1 (i2c-1), after user confirmation:
101              # i2cset 1 0x48 0x02 0x5000 w
102
103       Also see i2cget(8) for examples of combined usage of i2cset and i2cget.
104
105

BUGS

107       To  report  bugs  or  send fixes, please write to the Linux I2C mailing
108       list <linux-i2c@vger.kernel.org> with Cc  to  the  current  maintainer:
109       Jean Delvare <jdelvare@suse.de>.
110
111

SEE ALSO

113       i2cdetect(8), i2cdump(8), i2cget(8), i2ctransfer(8), isaset(8)
114
115

AUTHOR

117       Frodo Looijaard, Mark D. Studebaker and Jean Delvare
118
119       This  manual  page  was  originally  written by David Z Maze <dmaze@de‐
120       bian.org> for the Debian GNU/Linux system.
121
122
123
124                                 October 2017                        I2CSET(8)
Impressum