I2C to SPI Bridge

Document created by Hui_Ma Employee on Jan 22, 2017
Version 1Show Document
  • View in full screen mode
  • Background:

NXP SC18IS602B I2C bus to SPI bridge chip is using TSSOP16 package, which is 16 leads; 0.65 mm pitch; 5 mm x 4.4 mm x 1.1 mm body.

Customer requires to use a smaller package to emulate the SC18IS602B function.

Kinetis L series MKL03Z16VFK4R product uses QFN24 package with 4 mm x 4 mm x 0.58 mm body.

 

  • Demo Overview

The I2C to SPI Bridge demo provides a replacement solution demo of SC18IS602B chip. The demo is based on FRDM-KL03Z board using I2C0 module as I2C slave and SPI0 module as SPI master. Provided data buffer size is 400bytes. The demo software is based on KSDK V2.0 for FRDM-KL03Z software.

I2C slave interface:

Pin number                 Function              FRDM-KL03Z jumper

PTB3                          I2C0_SCL           J2-10

PTB4                          I2C0_SDA           J2-9

 

SPI master interface:

Pin number                 Function              FRDM-KL03Z jumper

PTA5                           SPI0_SS             J2_3

PTA6                           SPI0_MISO         J2_5

PTA7                           SPI0_MOSI         J2_4

PTB0                           SPI0_SCK           J2_6

 

INT pin (indicates if I2C to SPI Bridge allows i2c master start a new i2c transfer, low is active)

Pin number                 Function              FRDM-KL03Z jumper

PTB11                        GPIO output         J2_2

 

Connect I2C master with FRDM-KL03Z I2C slave interface and connect SPI slave with FRDM-KL03Z SPI master interface; Connect FRDM-KL03Z GND to I2C master and SPI slave before add power to those boards.  Below is the hardware platform connection way:

hardware connection way

 

  • I2C to SPI Bridge Demo Function

For the KL03 chip with one SPI0_PCS0 chip select pin, I2C to SPI Bridge demo only supports function ID 0x01 as SPI write command.

For example: if i2c master want to write 8bytes (0x21,0x22...0x28) to SPI slave, the i2c master needs to send below data to FRDM-KL03Z board:  

[START] + [I2C Slave address+/W] + [0x01](Function ID) + [0x21](data 1) + [0x22](data 2) + ... +[0x28](data 8) + [STOP]  

 

I2C to SPI bridge demo supports Function ID 0xF0 to configure SPI interface: There provides four SPI baud rate: 6Mbps/3Mbps/1.5Mbps/1Mbps. More detailed info, please check below picture (picture abstracted from SC18IS602B datasheet):

For example: customer could configure SPI baud rate to 3Mbps with send below data to FRDM-KL03Z board:

       [START] + [I2C Slave address+/W] + [0Xf0](Function ID) + [0x01](data 1) + [STOP]

 

 

  • Hardware Platform

The demo is based on FRDM-KL03Z board, using internal IRC48M clock as system and bus clock source. There doesn’t need external clock source.

 

  • Toolchain supported

- IAR embedded Workbench 7.60.1  (Tested)

- Keil MDK 5.18a

- GCC ARM Embedded 2015-4.9-q3

- Kinetis Development Studio IDE 3.2.0

 

  • Running the Demo
  1. Connect a USB cable between the host PC and the USB port on the target board.
  2. Open a serial terminal with the following settings:

    - 9600 baud rate

    - 8 data bits

    - No parity

    - One stop bit

    - No flow control

  1. Download the program to the target board.
  2. I2C master start to configure SPI interface

     I2C to SPI bridge board I2C address is 0x7E.

  1. I2C master write data to SPI slave

   I2C master write 10bytes to SPI slave, it will send 11bytes (includes one function ID 0x01). The first data is 0xAA and the last data is 0x22.

   After I2C to SPI Bridge receive the data, it will send 10bytes to SPI slave.

 

     I2C to SPI Bridge receive 10 bytes

    I2C to SPI Bridge send 10bytes to SPI slave

  1. I2C master read data from SPI slave

   I2C master read 10bytes(0x10 to 0x19) from SPI slave need to write data to SPI slave at first, then read data from I2C to SPI bridge data buffer directly.

   Here just shows read 10bytes from I2C to SPI bridge data buffer.

 

Attached I2C to SPI Bridge demo software default location is:

..\SDK_2.0_FRDM-KL03Z\boards\frdmkl03z\user_apps\i2c_to_spi

1 person found this helpful

Attachments

Outcomes