I²C

From Deskthority wiki
Jump to navigation Jump to search

I²C is a serial interface for communication between electronic components. An I²C bus has a microcontroller as master and one or more slaves components, of which there are many types.

I²C is often used for connecting left and right sides of a split ergonomic keyboard. It requires two data lines (SDA = serial data, and SCLK = serial clock), plus DC power. A keyboard interconnect with I²C therefore needs four wires. Different devices support 3.3V or 5V operation, and many work with both.

Signalling

The protocol is controlled by the master microcontroller. The master is clocking the bus on the SCLK line, and either device is sending a bit on the SDA line on each clock depending on that particular slave device's protocol.

Each transaction begins with the master sending a START bit, followed by an address byte with the address to the slave device to receive the transaction. If the higher bits of the first byte is 1-1-1-1, the address is instead in encoded in two bytes. Only the slave with the matching address should act on a transaction. Multiple more bytes can then follow, followed by a STOP bit.

Values are sent most-significant-bit first (multi-byte values are thus sent in big-endian byte order).

Slave devices

Many chips supporting I²C have higher bits of the address fixed, and lower bits configurable through one or more pins.

Class Device Address byte Notes
Trackball PIM447 0 0 0 0 1 0 1 A  Could be added to mini keyboards
Other hand Pro Micro 0 0 1 1 0 0 1 R/W Slave hand (left or right) on many split kit keyboards using QMK firmware. Unless overridden, the MCU makes itself slave if it does not detect VBUS.
I/O Expander MCP23018 0 1 0 0 A2 A1 A0 R/W ErgoDox
I/O Expander MCP23017 0 1 0 0 A2 A1 A0 R/W Functionally equivalent to MCP23018 but electrically less robust
OLED display SSD1306 0 1 1 1 1 0 A0 R/W Lily58 and others
EEPROM Atmel AT24C16C 1 0 1 0 B2 B1 B0 R/W Modified ErgoDoxen and Kinesis Advantage. Not recommended for new devices.
EEPROM Atmel AT24C164 1 A2 A1 A0 B2 B1 B0 R/W A1 is inverted so that A2-A1-A0 is 0-1-0 if all three address pins are connected to GND. B2-B2-B1 selects 256-byte block.
EEPROM Microchip 24LC64 1 0 1 0 A2 A1 A0 R/W Not compatible with Atmel AT24C16x above
LED matrix ISSI IS31FL3733 1 0 1 A3 A2 A1 A0 R/W Input Club K-Type (RGB) and others. 192 LEDs (64 RGB)
LED matrix ISSI IS31FL3731 1 1 1 0 1 A1 A0 R/W Input Club Infinity60 and others. 144 charlieplexed LEDs.

TRRS

A TRRS plug is a type of 3.5 mm phone connector used by many split ergonomic keyboards as interconnect. It is not considered very reliable for digital signals, but is inexpensive, common and relatively small.

"TRRS" stands for "Tip-Ring-Ring-Sleeve", indicating that is has four contacts. It was defined in the Japanese standard JEITA/EIAJ RC-5325A, "4-Pole miniature concentric plugs and jacks", originally published in 1993.

Keyboard Tip Ring Ring Sleeve
ErgoDox SDA SCLK Vcc GND
Lily58 Vcc GND SDA SCLK

External links