cancel
Showing results for 
Search instead for 
Did you mean: 

I2C and EEprom

mosine
Associate II
Posted on March 17, 2014 at 11:34

Hi,

I'm starting to develop an application where I'll manage EEprom data by I2C. Is there a complete example for stm32F0discovery? 

Thanks
2 REPLIES 2
Posted on March 17, 2014 at 13:22

It's for the EVAL board, but could be ported.

STM32F0xx_StdPeriph_Lib_V1.1.0\Project\STM32F0xx_StdPeriph_Examples\I2C\I2C_EEPROM
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mosine
Associate II
Posted on March 21, 2014 at 12:09

Thanks Clive1,

I did as you said and it all works, but I have a problem. When I need to do continuousreads o writes, my project doesn't work. My code:

if(nciclo == 0){
eeWriteBuffer(Tx1Buffer, 0, BUFFER_SIZE2); 
eeWaitEepromStandbyState();
eeWriteBuffer(Tx2Buffer, 32, BUFFER_SIZE2); 
eeWaitEepromStandbyState();
nciclo = 1;
}else{
eeRead(Rx1Buffer, 0, (uint16_t *)(&NumDataRead));
eeRead(Rx2Buffer, 32, (uint16_t *)(&NumDataRead));
nciclo = 0;
}

This code is into a task which is called every 100msec. The first time writes page0 and page1, the second time reads page0 and page1. When I read Rx1Buffer is ok, instead Rx2Buffer is empty. Why? Is there an instruction to wait the next write/read?