Hello,
I am trying to communicate the TMS570LC4357 (master) with an Arduino (slave) via I2C. The arduino is getting the request and it is sending three bytes, however they are not received by the microcontroller.
I know the communication is working because I am able to send data to the Arduino, using the sendByte function (for some reason with the i2cSend it doesn't work), but I am not capable of receiving.
This is my code:
uint8 *r_buff = &RX_PACK[0];
uint32 buf_size = bsize;
uint32 i = 0;
i2cInit();
while(i2cIsMasterReady(i2cREG2) != true);
i2cSetSlaveAdd(i2cREG2, slave_address); // for the I2C1, the master
i2cSetDirection(i2cREG2, I2C_RECEIVER);
i2cSetCount(i2cREG2, 3);
i2cSetMode(i2cREG2, I2C_MASTER);
i2cSetStop(i2cREG2);
i2cSetStart(i2cREG2); // only for the master
/* Tranmit DATA_COUNT number of data in Polling mode */
i2cReceive(i2cREG2, 3, &RX_PACK[0]);
/* Wait until Bus Busy is cleared */
while(i2cIsBusBusy(i2cREG2) == true);
i2cClearSCD(i2cREG2);
In this case, it is stuck at the i2cIsMasterReady statement. If I remove this line, it gets until the end of the main but no data is received.
Ground, SDA and SCL are connected to each other.
Thank you for your help. Best regards,
Sergio