- 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:
- 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
- Connect a USB cable between the host PC and the USB port on the target board.
- Open a serial terminal with the following settings:
- 9600 baud rate
- 8 data bits
- No parity
- One stop bit
- No flow control
- Download the program to the target board.
- I2C master start to configure SPI interface
I2C to SPI bridge board I2C address is 0x7E.
- 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
- 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
Original Attachment has been moved to: i2c_to_spi.zip
Hello,
when I use the chip I can only send 12 IC2 bytes at once (Address + FunctionID + data).
If I send more than 12 Bytes the chip pull the clock low, but not back (clock stretching).
Sometimes I get no acknowledge for the IC.
The IC has a buffer of 200 bytes but I can use only 10 bytes.
On you pictures, I see that you send only 12 bytes. (you send only 10 data bytes).
Do you have the same issue like me?