cancel
Showing results for 
Search instead for 
Did you mean: 

Eeprom m24m02-RD with HAL_I2C_Mem_Write and HAL_I2C_Mem_Read issue.

enricoricci51
Associate II

Hi all!

I'm facing a problem to get the eeprom working since whenever i try to write a page (256 bytes) or partial page with HAL_Mem routines the read function seems to read at the beginning wrong informations.

First of all i wish to clarify what eeprom code i've got on my board. In the figure below i'm seeing 24M02RD but the right name should be 24m02DR. Why? is the code correct? What does k737k mean?

0690X000008AowNQAS.png

As you can see the SCL and SDA lines are pulled up with 10K resistors and the bus is shared among several devices where everyone has its own unique address.

The device is supplied with a 3v3 voltage and uC used is STM32F429ZI. A2 phisycal address is tied to VSS.

Clock speed is 100000 and APB1 is 42MHz APB2 is 84MHz .

Before talking about my problem i want to say that during the tests the device has always answered with ACK and i2c peripheral had never got stuck with busy or hal_error codes. Furthermore the waveforms seems to be perfect with longer time than the eeprom datasheet requirements. (Unfortunately i can't attach the image here)

i'm going to show my test code below:

uint8_t tmp_buf_w[256], tmp_buf_r[256], i;
 
for(i=0; i < 256; i++) tmp_buf_w[i] = i;
 
HAL_I2C_Mem_Write(hi2c2, 0xA0, 0x0000, 0x0002, tmp_buf_w, 256, 1000);
 
HAL_I2C_Mem_Read(hi2c2, 0xA0, 0x0000, 0x0002, tmp_buf_r, 256, 1000);

I'm seeing that after that routine the first 31 bytes are corrupted and starting from the 32nd byte the tmp_buf_r is the same of tmp_buf_w.

It shouldn't be related to the 32 bytes page boundary because if i change memory address e.g. 256 or 512 this limit change. i.e. the buffer is corrupted for the first 10 or 15 bytes.

Any suggestions?

6 REPLIES 6
S.Ma
Principal

737 might be the datecode for 2017 week 37... the rest no clue.

Are you sure the PAGE is 256 bytes?

In 32 kbyte eeprom, my page is only 64 byte...

enricoricci51
Associate II

The datasheet says 256 bytes page. There are 1024 pages of 256 bytes each (m02 : 2Mb)​

Pierre P.
Senior III

​Hello,

Confirmed:

  • 2Mb I2c is a 256 bytes page.
  • 24m02RD is the good top marking

Warning with the pull-up value. 10K seems high to respect RC constant (see Figure 12 on datasheet  https://www.st.com/content/ccc/resource/technical/document/datasheet/b7/de/9b/f6/03/28/4e/8e/CD00290537.pdf/files/CD00290537.pdf/jcr:content/translations/en.CD00290537.pdf )

EEPROM support team

enricoricci51
Associate II

Hello,

Just now i've measured a rise time of 1.2 us in both lines SCL and SDA. Could it be the reason of problem?

Thanks

Pierre P.
Senior III

​Should be ok at 100KHz.

pdemianczuk
Associate

Hello, I have very similar problem with eeprom memeory 24AA01H (microchip);

The first byte after read was roll over so the transmission was corrupted.

Is this some problem with using pointer in HAL instructions? I am using STMF103 .

@enricoricci51​ did you solve your problem?