Changing I2C reading mode
Hi,
I am trying to create the I2C communication using the format used from the company seller of the device.
I have to follow these steps:
I2CReadFunciton ( uint8_t slAddr,
uint8_t* wrData, int wrLen,
uint8_t* rdData, int rdLen
Initiate the bus by issuing a START condition.
If there are bytes to write (wrLen > 0):
- Address the target device with its slave address in write mode.
- Transmit the wrLen bytes contained in wrData.
- Without releasing the bus (i.e., do not send a STOP), issue a REPEATED START to transition into the read phase.
Begin the read phase:
- Address the same device with its slave address in read mode.
- Receive rdLen bytes, storing them sequentially into rdData.
Terminate the transaction with a STOP condition.
Key constraints:
- If a write phase occurs, it must be immediately followed by a repeated start—no STOP is allowed between the write and the subsequent read.
- The read always occurs after either the initial START (if no write) or the repeated START (if a write was performed).
My problem is how to not have the stop condition in the write function using the HAL functions.
