Hello everybody,
I have a strange problem with the driver I2c (I2C Master Drive on r_iic).
I use it on a S3A1 with a "custom" board with SSP v1.3.3 and e2studio v5.4.0.023.
The g_i2c0.p_api-> write command seems OK, since the device address is sent, (0x78 in 7bits address mode), with the desired number of data. However, the data sent is wrong ... the module sends 0x80 instead of 0x00 and 0xD7 instead of 0xAE for example. Why ??
I do not use RTos in this program.
My code:
_err = g_i2c0.p_api-> open (g_i2c0.p_ctrl, g_i2c0.p_cfg);
if (_err ! = SSP_SUCCESS)
while (1);
_err = g_i2c0.p_api-> reset (g_i2c0.p_ctrl);
if (_err ! = SSP_SUCCESS)
while (1);
SentByte (0xae); // - turn off oled panel
With:
void SentByte (unsigned char Byte)
{
I2CBuffer.NbrBytestoSend = 0;
I2CBuffer.SendBuffer [I2CBuffer.NbrBytestoSend ++] = 0;
I2CBuffer.SendBuffer [I2CBuffer.NbrBytestoSend ++] = Byte;
if (I2CBuffer.NbrBytestoSend> = sizeof (I2CBuffer.SendBuffer))
{
I2CBuffer.NbrBytestoSend = 0;
I2CBuffer.SendbufferFullError = true;
}
else
I2C_Write ();
}
and:
void I2C_Write (void)
{
ssp_err_t _err;
_err = g_i2c0.p_api-> write (g_i2c0.p_ctrl, & I2CBuffer.SendBuffer [0], I2CBuffer.NbrBytestoSend, false);
if (_err! = SSP_SUCCESS)
{
while (1);
}
else
{
I2CBuffer.NbrBytestoSend = 0;
I2CBuffer.SendbufferFullError = false;
}
}
Here the screenshot of the oscilloscope:
Here the screenshot of driver config:
(I don't use interrupt callback for the moment)
Thanks in advance for your help,
Eric