2024-08-25 09:51 PM
I have been working on interfacing a Realtek switch and the Realtek configuration was done by i2c bit banging. I am currently trying to change to HAL I2C and am in need of performing a read operation as shown.
Here the read operation is performed such that the read address write is done as the part of read operation. In STM32H5 Hal I2C driver, I tried making modifications to mimic this sequence, but in all the cases, the address write is only done as part of a write operation only. Is there any way to modify the driver such that the exact same signal generation sequence occurs.
2024-08-26 06:07 AM - edited 2024-08-26 06:08 AM
What you have shown is a standard read operation of 4 bytes from address 0x5C. This is doable without modifying the driver.
uint8_t buffer[4] = {0};
HAL_I2C_Master_Receive(&hi2c, 0x5C << 1, &buffer, 4, HAL_MAX_DELAY);
Or perhaps you meant to show a different transaction where you write the memory address, then read it, which can be done with HAL_I2C_Mem_Read.