Demand Peripherals     Robotics and Automation Made Easy

EI2C: Generic I2C Interface

The EI2C peripheral and card provide a general purpose I2C interface for your robot or other automation.

Reads and writes to the I2C bus are organized as packets that can have up to 13 data bytes. You can intermix reads and writes but each transition from read to write (or back) takes one byte from the 14 data bytes available.

Read responses are available from a separate resource and each read response indicates success or failure of the packet.



The I2C interface card supports clock-stretching and has clock rates of 400 and 100 KHz. The card must be the only master on the bus.

The EI2C card has a prototyping area as well as connectors for SCL, SDA, +3.3, +5, and ground. Jumpers let you select the pull-up resistor voltage and let you use external pull-up resistors if you wish. More information about the EI2C card is available here: /cards/ei2c.html



Resources for the EI2C peripheral include clock rate configuration and resources to send and receive packets

config : The clock rate in Kilohertz as a single integer terminated by a newline. Valid clock rates are 400 and 100.

data : the data to send to the I2C device as up to 13 values separated by spaces and terminated by a newline. Data bytes are given in hexadecimal and an 'R' marks the transition from write to read in the packet. The format for an I2C packet is:

        <addr> <hex|R> ... <hex|R>

The dpget command provides both read and write functionality for the EI2C peripheral. Additional bytes on the dpget command line are sent to the I2C device and each byte sent gives another hex value in the response.

Responses start with either an 'A' or an 'N' to indicate whether all bytes were ACK'ed. The second string in the response is the hex value of the address. The remaining hex values are the read responses or an echo of the data written. The 'w' and 'r' characters indicate a write or read response. A newline terminates the response.



The Microchip MCP23008 is an 8 bit expansion port with an I2C interface. The part has ten internal read-write registers for configuration and data. Commands to the part have the I2C address, a write of the register number, and a read or write of the data for that register. The command to write a 55 to register 3 in the MCP23008 with an address of 0x20 would be:

        dpget ei2c data 20 03 55
The response to the above read command would be:
        A 20 w 03 55

A read of that same register would be:

        dpget ei2c data 20 03 R 
The response to this command would be:
        A 20 w 03 r 55


FPGA Defined Peripherals
User Interface
FPGA Configuration
FPGA Buttons & LEDs
Host Tx/Rx Interface
AVR Interface
Stereo Audio Amplifier
Text LCD and Keypad
Quad WS2812 Interface
Quad Slide Pot
IR Recv/Xmit
6 Digit LCD
RC Decoder
Keyfob RF Decoder
Rotary Encoder Interface
Quad Touch Interface
Motion Control
Dual DC Motor Controller
Dual Quadrature Decoder
Quad 13 Bit Servo
Bipolar Stepper Controller
Unipolar Stepper Controller
Simple Input / Output
Quad Binary Output
Quad Binary Input
Octal Input/Output
32 Channel Binary Output
32 Channel Binary Input
Quad Serial Output
Octal Serial Output
Octal 12-bit ADC
Quad Ping))) Interface
Pololu QTR Interface
Octal SRF04 Interface
Generic I2C
Generic SPI
Octal 8-Bit DAC
Quad Digital Potentiometer
Quad PWM Output
Quad PWM Input
Quad Event Counter
Real Time Clock
Dual Pulse Generator

Interface Cards
Control Cards
User Interface
Stereo Audio Amplifier
IR Recv/xmit
Six Digit LCD Display
Keyfob RF Receiver
Rotary Encoder
Quad Switch Card
Text LCD / keypad
Quad Slide Pot
Quad Touch Interface
Motion Control
Dual 7-amp H-bridge
Quad Open Drain Driver
Quad 10 Amp Relay Card
Input / Output
Octal 8-Bit DAC
Quad Digital Potentiometer
Octal 12-bit ADC
Octal SRF04
I2C Prototyping
SPI Prototyping
USB 2.0 Hub
Real Time Clock
Octal Input/Output
32 Channel Input
32 Channel Output
Power Distribution Card
15 Amp Power Distribution
5 Volt Switching Regulator
ATX Power Break-Out Card
Disk Drive Power Break-Out
MP43 Aluminum Mounting Plate
WW4 Large Prototyping Card
WW2 Prototyping Card
WW1 Small Prototyping Card
SMP SMD Prototyping Card