2020-11-14 10:17 AM
I generated the code using STM32CubeMX for STM32f423rh to communicate with AT24C02 EEPROM via i2c 1
I am can able to do page write/read by using HAL_I2C_Mem_Write_IT function. But i am not getting how to do random read.
Please provide any example code
Thank you
2020-11-15 05:18 AM
Check DataSheet
For multibyte read watch that you dont span pages, decompose into smaller reads when required.
2020-11-15 10:12 AM
I am first time working on EEPROM and STM32
Which function i need to use from STM32 library to decompose into smaller read for random read
2020-11-15 12:56 PM
You'd have to manage the decomposition based on your understanding of the device.
ie You'd have your wrapper function to read the EEPROM, and in there you'd check the address and length request, and see how that falls on the page / page boundaries. If it involves two pages, you're going to have to split it so it reads the portion from the first page, and then the portion from the second page.
You'd use HAL_I2C_Mem_Read(_IT) twice..