• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoArduino-ish ProgramI2CI2CSET
Previous Next

I2CSET

Posted by: Yang , June 3, 2014

I2CSET

NAME

i2cset – set I2C registers

SYNOPSIS

i2cset [-y] i2cbus chip-address data-address value [mode] [mask]
i2cset -V

DESCRIPTION

i2cset is a small helper program to set registers visible through the I2C bus.

OPTIONS

  • -V Display the version and exit.
  • -y Disable interactive mode. By default, i2cset will wait for a confirmation from the user before messing with the I2C bus. When this flag is used, it will perform the operation directly. This is mainly meant to be used in scripts.

There are four required options to i2cset. i2cbus indicates the number of the I2C bus to be scanned. This number should correspond to one of the busses listed by i2cdetect -l. chip-address specifies the address of the chip on that bus, and is an integer between 0x00 and 0x7F. data-address specifies the address on that chip to write to, and is an integer between 0x00 and 0xFF. value is the value to write to that location on the chip.

The mode parameter, if specified, is one of the letters b or w, corresponding to a write size of a single byte or a 16-bit word, respectively. A p can also be appended to the mode parameter to enable PEC. If the mode parameter is omitted, i2cset defaults to byte mode without PEC. The value provided must be within range for the specified data type (0x00-0xFF for bytes, 0x0000-0xFFFF for words).

The mask parameter, if specified, describes which bits of value will be actually written to data-address. Bits set to 1 in the mask are taken from value, while bits set to 0 will be read from data-address and thus preserved by the operation.

WARNING

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

CONFORMING TO

lm_sensors-2.x

via

Tags: I2C

Share!
Tweet

Yang

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors