2024-06-12 12:36 PM - edited 2024-06-12 12:38 PM
Hello All.
Reading a register value from an I2C device assumes: Writing the device address-> Writing the register address without STOP-> Reading the value . I am trying to figure out if I can do it using only available HAL functions but I don't see how. Simple Write followed by Read includes STOP, which is not in full compliant with the rules.
Yes, if needed, I can rewrite everything but maybe there is an option, which I don't notice?
I use STM32G0B0 with HAL libraries.
Solved! Go to Solution.
2024-06-19 05:43 PM
Thanks! That is the solution.
2024-06-12 01:04 PM
For EEPROM, IMU, etc this form tends to be workable
HAL_StatusTypeDef status = HAL_I2C_Mem_Read(&I2CHandle, (0x42 << 1), 0xFF, 1, buffer, len, 300); // Read data block from register position 0xFF (8-bit)
Supports 8 and 16-bit addressing within the Slave, and whatever length auto-increments
2024-06-19 05:43 PM
Thanks! That is the solution.