AnsweredAssumed Answered

AT24CM02 interfacing issues with STM32F072

Question asked by Nandakumar Palaparambil on Jan 19, 2018
Latest reply on Jan 20, 2018 by Nandakumar Palaparambil

Hi,

 

In our project we are using STM32F072 and have 2 Atmel AT24CM02 serial EEPROM (256KB,256 page) over i2c interface. I am using standard peripheral library 1.5 for developing firmware for this. I find strange behavior while testing this serial EEPROM under this environment.

 

I write two locations 0x0005 and 0x0009 with 0x44 and 0x55 respectively, when I read back I get both locations as 0x55. Typically it looks like one write gets into multiple locations of the page. If I read 0x0005 immediately after write, I get value 0x44.

 

See the sample test code, and complete driver code which is ported from peripheral library is attached. The PCLK clock runs at 3MHz and using i2c timing configuration tool, timings were calculated and put. I have another RTC chip on the same interface and it works perfectly fine. Tested both the serial EEPROM chips (one has A2 connected to VCC and other one to GND), and behavior is same. 

 

Any help is appreciated.

 

void at24cm02_write_read_test(void)
{
uint16_t addr;
uint16_t num;
uint8_t bytes;

/* Initialize the I2C EEPROM driver ----------------------------------------*/
sEE_Init();

/* First write in the memory followed by a read of the written data --------*/
/* Write on I2C EEPROM from sEE_WRITE_ADDRESS1 */

TxBuffer[0] = 0x44;
TxBuffer[1] = 0x55;

bytes = 1;
addr = 0x0005;
sEE_WritePage((uint8_t *)&TxBuffer[0],addr,&bytes);
Delay_Ticks(10); //200ms delay, much larger than needed

printf("Write 1 complete\n\r");

bytes = 1;
addr = 0x0009;
sEE_WritePage((uint8_t *)&TxBuffer[1],addr,&bytes);
Delay_Ticks(20);

printf("Write 2 complete\n\r");

num = 1;
sEE_ReadBuffer(&RxBuffer[0], 0x0005, (uint16_t *)(&num));
Delay_Ticks(2);
printf("%x ",RxBuffer[0]);

num= 1;
sEE_ReadBuffer(&RxBuffer[1], 0x0006, (uint16_t *)(&num));
Delay_Ticks(2);
printf("%x ",RxBuffer[1]);

printf("Reads complete\n\r");

}

Outcomes