I2C to SPI using SC18IS602B

Hello
I am using Arduino UNO ( atmega32p), in I2C mode, and i am trying to communicate with an SPI accelerometer, and i have used SC18IS602 as an I2C to SPI converter.

///////// Just to inform everyone, I know that i can directly connect Arduino with an SPI device, But i want to communicate this way, its a project from my university///////

Every thing works fine in this code, the only problem is that i am not able to read the Buffer of SC18IS602 to read the data from my sensor.

I connected a scope to the MISO pin of my sensor and it is transmitting the data to the Bridge device but i am not able to read this data from arduino.

Here is my Code

#include <Wire.h>

char address = 0x28;
unsigned char regid1 = 0;
unsigned char regid2 =0;
unsigned char regid3 = 0;
unsigned char regid4 =0;
#define RESET_PIN 4

void setup() {
//Reset SC18

delay(5000);
pinMode(RESET_PIN,OUTPUT);
digitalWrite(RESET_PIN,HIGH);
delay(100);
digitalWrite(RESET_PIN,LOW);
delay(100);
digitalWrite(RESET_PIN,HIGH);
delay(1000); // Let the device to become stable

Serial.begin(9600);
Wire.begin();

/////////// SPI Configuration for Accelerometer /////////

Wire.beginTransmission(address);
Wire.write(0xf0);
Wire.write(0x02);
Wire.endTransmission();
delay(100);

////////////// Enable chip select pin and send some dummy data//////////////////

Wire.beginTransmission(address);
Wire.write(0x01); // CS0
Wire.write(0x06); // Dummy Data
Wire.endTransmission();
delay(100);

}

void loop() {

// Sending the read command to the Accelerometer

Wire.beginTransmission(address);
Wire.write(0x01); // Chip select SS0
Wire.write(0x80); // Accelerometer register ID with Read BIT
Wire.write(0x90); // Dummy Data
Wire.endTransmission();

/// Until this point my code is fine, as i can see the data on MISO using Osciloscope

// reading the buffer —>> This part is not working, i am not able to read the buffer , its printing FF or 00

Wire.requestFrom(address,byte(4));
regid1 = Wire.read();
regid2 = Wire.read();
regid3 = Wire.read();
regid4 = Wire.read();

Serial.print(regid1,HEX);
Serial.print("\n");
Serial.print(regid2,HEX);
Serial.print("\n");
Serial.print(regid3,HEX);
Serial.print("\n");
Serial.print(regid4,HEX);
Serial.print("\n");

}

I suspect you won't find many people here who have used this chip before, so you won't get much useful input.

If I was faced with this problem, I would use a small Arduino, like a Nano or Mini to do the conversion.

http://www.nxp.com/documents/data_sheet/SC18IS602_602B_603.pdf

I think this is incorrect
char address = 0x28;
per 7.1.1 Addressing
Should be 0b0101xxx0 (write) and 0b0101xxx1 (read) with the xxx being however you have the A2-A1-A0 bits tied (high or low).
If wire.h is only expecting 0101000 and adding 0 or 1 as the LSB, then 0x28 is correct. You could try 0x50, 0x51 and see it makes a difference.

i found the answer to it my self :slight_smile:
But thank you guys

The problem is in the timings,

I had to put a delay of 1ms between sending the command to the buffer and to read the buffer.