I2C Bus Communications

Supported by ...

All PL-B board level cameras.

Description

I2C (pronounced I squared C) is short for Inter-Integrated Circuit bus, a type of bus which is used to connect integrated circuits (ICs). It is used to connect low-speed peripherals in an embedded system or motherboard.   I2C is a multi-master bus, which means that multiple chips can be connected to the same bus and each one can act as a master by initiating a data transfer.

Typical applications for the I2C communication feature is to use the PixeLINK imaging module as the main point of communication between the host and associated peripheral equipment.  For example, suppose the camera is on a microscope and the microscope has a motorized stage with a serial control interface.  Rather than having a USB connection to the camera and a serial connection to the stage, the application can use the camera to talk to the stage and simplify the wiring requirements to the host.

For details on the mechanical and electrical connections required, see the Hardware - PL-B Board Level COM Interface topic.

API Control

The I2C bus can be controlled using two functions from the SDK, PxLCameraRead() and PxLCameraWrite(). A buffer with the following format should be passed to these calls:

struct

{

    ULONG Command;             // Set to 0x00008005 to Read and 0x00008006 to Write

 

    ULONG DeviceAddress;      // I2C Device Address

    ULONG OutputBufferSize;   // Number of bytes to write

    ULONG InputBufferSize;      // Number of bytes to read (Should be 0 for write requests)

   

    UCHAR OutputBuffer[OuputBufferSize];

    UCHAR InputBuffer[InputBufferSize];

};

For example, to write a byte to a device with a device address of 0xA0, and 16-bit internal addresses, call PxLCameraWrite() with the buffer setup as follows:

If the acknowledges are not received correctly, PxLCameraWrite() will return an error.

 

A read example: To read two bytes from a device with a device address of 0x56, and 8-bit internal address, call PxLCameraWrite() with the buffer setup as follows:

To retrieve the data call PxLCameraRead() with the same buffer size as was passed in to PxLCameraWrite(). InputBuffer will now contain the two bytes read from the I2C device.

IIDC Control

I2C Bus communications are not controllable through the IIDC protocol.