Hello,
I'm trying to set up I2C with an mCube cccelerometer, which has an I2C 7 digit ID of 0x6C and an 8 bit address (write) of 0xD8.
With the code below, I see on my oscilloscope an infinite sequence of transmissions of 0xD8.
Ideally, if the master and slave linked perfectly, I should not be seeing a never ending sequence in this case, am I right?
Any suggestions on what could be going wrong here?
void main() {
P0DIR = 0x00;
P1DIR = 0x00;
P2DIR = 0xFF;
P3DIR = 0x00;
EA = 0;
hal_w2_configure_master(HAL_W2_100KHZ);
/* initiation sequence*/
hal_w2_write(0xD8,i0, 2); // standby mode
hal_w2_write(0xD8,i1, 2); // reset or power on
delay_us(10000);
hal_w2_write(0xD8,i2, 2); // specifying interface
hal_w2_write(0xD8,i3, 2);
hal_w2_write(0xD8,i4, 2);
hal_w2_write(0xD8,i5, 2);
hal_w2_write(0xD8,i6, 2);
hal_w2_write(0xD8,i7, 2);
}
void I2C_IRQ (void) interrupt INTERRUPT_SERIAL
{
I2C_IRQ_handler();
}
Thanks for your time!