SC18IS602 I2C to SPI Bridge Module

Overview

This module is designed to serve as an interface between a standard I2C-bus of a microcontroller and an SPI bus. This allows the microcontroller to communicate directly with SPI devices through its I2C-bus. This module operates as an I2C-bus slave-transmitter or slave-receiver and an SPI master. It controls all the SPI bus-specific sequences, protocol, and timing.

This module is useful when there is no SPI interface on the microcontroller or the SPI interface is occupied for something else. Due to the multi-slave characteristics of I2C bus, multiple such modules could be added to the system at the same time.

Features

LED indicators for the SCL, and SDA activities

4 extra software programmable GPIOs for IO expansion

Up to 1.8MHz SPI Clock

3-pin, 4-pin interlock connectors onboard

Arduino IDE compatible library

All pins are 5V tolerant (after power supply applied)

5V MOSI, SCK, SS0, SS3 output.

Compact size

Pin Configuration

VCC: 5V power supply (Power)

SCL: I2C Bus Clock (Input)

SDA: I2C Bus Data (Open drain)

INT: SC18IS602 IRQ (Open drain)

MOSI: Master Out Slave In (Push-pull)

MISO: Master In Slave Out (Input)

SCK: SPI Clock (Push-pull)

SS0/GPIO0: Chip select output SS0 or GPIO0

SS1/GPIO1: Chip select output SS1 or GPIO1

IO2: GPIO2

SS3/GPIO3: Chip select output SS3 or GPIO3

GND: Common Ground (Power)

I2C Address Selection

The I2C address of the module can be set to any value between 0x50-0x5E (8-bit I2C Address, odd address for reading and even address for writing). The address is set by the three resistors marked by the red box shown in the following picture.

By default all resistors are soldered to “0”, this yields a writing address of 0x50 and a reading address of 0x51.

Install the Library and Run the example sketch

Download the SPIBRIDGE.zip and unzip the file to the Arduino library directory. The Arduino example directory is the folder examples under Arduino program root folder. e.g. C:\Program Files (x86)\Arduino\examples

Start the Arduino IDE.

Select the example sketch from File->Examples->SPIBRIDGE->SELFTEST.

Short the MOSI and MISO pins together.

Upload the sketch.

Both LEDs should flash in 300ms interval.

The library provides a set of SPI communication functions similar to that of the original Arduino SPI library. Basically, a class named SC18IS602 is used instead of the original SPI class.

To use this library, an object should be created by referencing the class SC18IS602.

1

SC18IS602i2cspi=SC18IS602(SC18IS602_ADDRESS_000);

To initialize the module and choose ss0 as the chip select pin

1

i2cspi.begin(0);

To send a byte 0x55 and simultaneously receive a byte from SPI

1

received_byte=i2cspi.transfer(0x55);

To set gpio0 as an input pin

1

i2cspi.pinMode(0,INPUT);

To set gpio0 as an output pin

1

i2cspi.pinMode(0,OUTPUT);

To set gpio0 to HIGH

1

i2cspi.digitalWrite(0,1);

To read from gpio0

1

i2cspi.digitalRead(0);

Other methods like setBitOrder(), setClockDivider(), setDataMode(), etc., are also supported by the library.

Contents

About us

Sandbox Electronics is a studio that design electronics and sell these bits and pieces worldwide. We are proud of our geeky culture at Sandbox Electronics and would love to share our experiences and fun stories online.