I2C

API Documentation: [cpp] [python] [.NET] [LabVIEW]

BrainStem modules may have the ability to read, write data on up to 2 I2C bus’s


Read/Write Data

BrainStem modules may have the ability to read, write data on up to 2 I2C bus’s. The MTM-RELAY includes access to a single I2C bus operating at a set 1Mbit/s rate.

Note

The 1Mbit/s bus, while user-accessible, is also used for BrainStem network communication so there may be other, non-user-initiated traffic when other BrainStem modules are linked.

stem.i2c[index].read(address,length) [cpp] [python] [NET] [LabVIEW]

stem.i2c[index].write(address,length) [cpp] [python] [NET] [LabVIEW]

The maximum data size for individual read and write operations on an I2C bus through the BrainStem API is 20 bytes. Sending more than 20 bytes of information must be done as an iterated sequence.

Pullup

Each I2C bus also includes 330Ω pull-up resistors on the SDA and SCL lines, disabled by default. When using the MTM-RELAY in a linked system (communicating over the 1Mbit/s bus), only a single set of pull-ups along the bus should be enabled in order for the I2C bus to work properly (if more than one set is enabled, the lines cannot be pulled low for communication). Similarly, when using a single MTM device to communicate with an external device over the I2C bus, either the internal pull-ups can be enabled, or external hardware pull-ups added.

stem.i2c[index].setPullup(bEnable) [cpp] [python] [NET] [LabVIEW]