cancel
Showing results for 
Search instead for 
Did you mean: 

how can I fetch external eeprom 24c64 using stm32f0 cortex MO based controller ?

Dhiraj Ghodmare
Associate II

I use stm31f0 micro controller & 24c64 eeprom for store data but unfortunately I'm not able to fetch and store data you have any solution please help me I'm attached my code bellow

char data_eeprom[255];

void write_eeprom(uint16_t posi,uint8_t dt)

{

HAL_I2C_Mem_Write(&hi2c1,0xA0<<1,posi,0xff,&dt,1,1000);

HAL_Delay(5);

}

uint8_t read_eeprom(uint16_t posi)

{

uint8_t dt;

HAL_I2C_Mem_Read(&hi2c1,0xA0<<1,posi,0xff,&dt,1,100);

return dt;

}

void writeString_eeprom(uint16_t posi,char*dt)

{

write_eeprom(posi,strlen(dt));

for(int a=0;a<strlen(dt);a++)

{

write_eeprom(posi+1+a,dt[a]);

}

}

void readString_eeprom(uint16_t posi)

{

uint16_t l_str=read_eeprom(posi);

memset(data_eeprom,0,255);

for(int a=0;a<l_str;a++)

{

data_eeprom[a]=read_eeprom(posi+1+a);

}

}

4 REPLIES 4

Observe SDA/SCL using oscilloscope/logic analyzer.

JW

0xA0 is already left aligned you shouldn't need to shift it again.​

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

I remove shift right by one, its work but "data_eeprom buffer" shows value "0x19" in character

What's the 0xFF here?

#define I2C_MEMADD_SIZE_8BIT   (0x00000001U)

#define I2C_MEMADD_SIZE_16BIT   (0x00000002U)

Getting any errors/status reported?

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