Hello @avinashstarkenn,
First I would like to give you a few details about the MBDT implementation of the I2C component.
The request structure required in the I2c_SyncTransmit and I2c_AsyncTransmit functions has the following parameters:
- SlaveAddress: Slave Device Address.
- BitsSlaveAddressSize: This is true when the slave address is 10 bits, when false the address is on 7 bits.
- HighSpeedMode: If this is true the data will be sent with high speed enabled (if hardware support exists).
- ExpectNack: When this is true, NACK will be ignored during the address cycle.
- RepeatedStart: When this is true, a repeated start (Sr) will be issued on the bus instead of a STOP at the end of the transfer.
- BufferSize: The number of bytes for reading or writing.
- DataDirection: Direction of the data, can be either Send or Receive.
- DataBuffer: Buffer to store or to transmit Serial data.
The Data Direction parameter can be chosen from the drop-down menu inside the block mask. The 10 Bits Slave Address Size and High Speed Mode parameters can be selected from the checkboxes inside the block mask.
The Slave Address, Repeated Start, Expect Nack, Data Tx (for the Send direction), Buffer Size (for the Receive direction) parameters are expected as inputs to the block, while Data Rx (for the Receive direction) will be an output to the block.
If you want to send multiple bytes from the master, you can simply create a Data Store Memory block containing the bytes and give it as an input (Data Tx) for the block, using the Data Store Read block.
If you want to request multiple bytes from the slave, you must specify the number of bytes in the Buffer Size block input, create a Data Store Memory block with the same size as the number of bytes, and provide it as an output for the block using the Data Store Write block.
For more details about LPI2C and FLEXIO peripherals, you can check chapters 71 and 72 of the Reference Manual located in mbdtbx_s32k3\help\docs. You can also check the RTD I2C User Manual located in S32K3_RTD\SW32K3_S32M27x_RTD_R21-11_5.0.0\eclipse\plugins\I2c_TS_T40D34M50I0R0\doc.
Specifically for your sensor, in order to access a particular register, you first need to write the appropriate value to the Pointer register. For example, if you want to access the Temperature register, you have to send the slave address byte with the R/W bit low (for writing), followed by the byte 00000000. Then you need to send the device address with the R/W bit high (for reading) and store the next 2 bytes received, since the Temperature Register is a 12-bit register stored in 2 bytes.
For this you will need 2 request structures, one for sending data from the MCU to the sensor and one for receiving data from the sensor to the MCU. First you will need to use the I2c_SyncTransmit/I2c_AsyncTransmit function (with Data Direction set to Send) to send the byte 00000000 to the sensor, then use the same function (with Data Direction set to Receive) to receive the 2 bytes representing the Temperature register.
If you want the write and read operations to occur between the start and stop conditions, you can try setting the Repeated Start to true for the first request structure, but changes to the configuration project may be required for the scenario to work as expected.
Finally, have you tried requesting data from the sensor without first writing to the Pointer register? The datasheet states that the Pointer register is set to the Temperature register by default, so you could try reading directly from the sensor without the write operation. Note that the TMP75 remembers the Pointer register value that was sent with the last write operation. If you only want repeated reads from the Temperature register, the Pointer register bytes do not need to be sent continuously.
If you encounter further issues after trying these suggestions, you can send us your application or the generated code so we can better understand the implementation you are trying to achieve.
Best regards,
Cristina