Skip to main content
KM.6
Associate
Nov 14, 2020 6:17 PM UTC
Question

AT24C02 EEPROM Random read

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

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
Nov 15, 2020 1:18 PM UTC

Check DataSheet

For multibyte read watch that you dont span pages, decompose into smaller reads when required.​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
KM.6
KM.6Author
Associate
Nov 15, 2020 6:12 PM UTC

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

Tesla DeLorean
Guru
Nov 15, 2020 8:56 PM UTC

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..

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..