Hi all,
I am trying to use i2c to communicate with IRThermo MLX90614, which requires sending an address byte first then a read of three bytes (no stop bit) after sending the address.
Using HALCoGen, I generated the required code, enabling the required mux pins etc...
As per the TRM for TMS570LC43:
To start with I need to set i2c transmitter as "(Repeat) Start" with RM=0, STT=1 and STP=0, which works fine and I see it on the logic analyzer, but that is how far it goes, as I have a check statement: while(i2cIsBusBusy(i2c1) == true);
In the table, it says "Repeat n", but how "n" is set?
I have tried many approaches:
1- I set i2cSetCount which define how many bytes but it cause the CPU to generate the stop bit!
2- Removing the check statement will cause the program to go further, but it gets stuck when it tries to receive data (probably bus busy)
3- I have tried to reset the i2c before I reconfigure as a receiving master, but still nothing happening when trying to receive data.
#define MLX90614_ADDRESS 0x5A i2cInit(); uint8 sensTemp[3]; i2cSetMode(i2c1, I2C_MASTER); i2cSetSlaveAdd(i2c1, MLX90614_ADDRESS); i2cSetDirection(i2c1, I2C_TRANSMITTER); i2cSetStart(i2c1); i2cSendByte(i2c1, 0x07); while(i2cIsBusBusy(i2c1) == true); i2c1->MDR = 0; for(i = 0; i< 10000 ; i++); i2cSetSlaveAdd(i2c1, MLX90614_ADDRESS); i2cSetDirection(i2c1, I2C_RECEIVER); i2cSetCount(i2c1,3); i2cSetMode(i2c1, I2C_MASTER); i2cSetStop(i2c1); i2cSetStart(i2c1); i2cReceive(i2c1, 3, sensTemp); while(i2cIsBusBusy(i2c1) == true); while(i2cIsStopDetected(i2c1) == 0); i2cClearSCD(i2c1);
Here is what I see on the logic analyzer:
For the sequence to work, the MC shall send a start bit after what is showing in the screen shot.
Regards
Fouad
#Edit#
Looking at the TRM again, it seems I meet the prerequisite for a reapted start!
Is there any HALCoGen drivers programming deference?
Regards
Fouad











