cancel
Showing results for 
Search instead for 
Did you mean: 

I2C EEPROM and External SRAM as Data Memory

jki79ros81
Associate II
Posted on December 18, 2008 at 04:04

I2C EEPROM and External SRAM as Data Memory

13 REPLIES 13
jki79ros81
Associate II
Posted on May 17, 2011 at 12:55

I used i2c EEPROM and it works OK.

And I added SRAM as data memory, because global variables are many.

If I use SRAM as shown in sample SRAM_DataMemory, i2c dos'nt work.

brief code is follow.

/* While the bus is busy */

while(I2C_GetFlagStatus(I2C1, I2C_FLAG_BUSY));

/* Send START condition */

I2C_GenerateSTART(I2C1, ENABLE);

/* Test on EV5 and clear it */

while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_MODE_SELECT));----------------------------> at this point endless wait

I define as ''DATA_IN_ExtSRAM EQU 0'' in stm32f10x_vector.s, then i2c work OK.

And I tested SRAM without the using i2c eeprom, SRAM works OK.

If I use SRAM as data memory, why i2c dos'nt work?

Please help me.

Thank you.

jki

jj
Associate II
Posted on May 17, 2011 at 12:55

Appears that you're using ''high-density,'' FSMC device. Always best if you specify which part (and toolset) you're using.

Suggestions:

a) check your chip's most recent ''errata'' - perhaps your application is disallowed

b) do you correctly manage the Alternate Function and/or Remapping?

c) do you enable the clock properly for both of these peripherals?

jki79ros81
Associate II
Posted on May 17, 2011 at 12:55

Hi, jj.sprague!

Thank you very much.

I found a mistake in my design .

In Errata sheet said.

''Concerning I2C1, it is possible to use the remap functionality available on the PB8 and PB9 pins.''

I used I2C1(PB6,PB7).

Thank you very much for your advance.

hervett
Associate II
Posted on May 17, 2011 at 12:55

Hello,

I'm just starting to try to use I2C EEPROM 24C64 with my STM32, and i'm trying to use PB6 and PB7 for SCL and SDA, If I understand I have to remap in PB8 and PB9 ? Otherwise I will have problems ? I'm using a 100 pin packaged STM32F103.

.

And Maybe I will want your help jki79ros81 if I can't succes to create WriteData et ReadData for my I2C EEPROM

jj
Associate II
Posted on May 17, 2011 at 12:55

@hervett,

Each application/case is unique - depends on which peripherals & which class device you have.

As I advised jki - read your chip's errata carefully. It may be that you do not have to make any ''re-maps.''

The great cap
hervett
Associate II
Posted on May 17, 2011 at 12:55

Hello,

You're right JJ, and I'm trying point after point to speak with my EEPROM 24C64....and I'm still with PB6-7 and I will see ....but for the moment, I have problems in the first step after my GenerationStart and after sending slave's adress, I don't have ACK, so I'm working on that !!

jj
Associate II
Posted on May 17, 2011 at 12:55

hi back,

Yours is ''classic'' I2C problem (ACK). Check carefully that after ''sending'' to your eeprom (via SDA) you change SDA from open-drain output to input. (this probably the hardest part)

Did you add pull-up R's to both SDA & SCL? (missing R on SDA would prevent you're seeing ACK!)

ST has several I2C examples - look for ones which ''read'' from the eeprom as they ''must'' switch the SDA line. Good luck - let us know how you solve...

[ This message was edited by: jj.sprague on 16-12-2008 12:08 ]

hervett
Associate II
Posted on May 17, 2011 at 12:55

Hello JJ,

I'm still on my problem, I'm using the exemple5 of I2C library in order to use my EEPROM, after some modification, my program stop on the checking of EV6. At first I generate the Start condition, and works perfectly( see it on oscilloscope ), and after I SEnd7bitAdress but I think there is problem on that because I have no ACK . And I don't know if the checking of EV6 check too the ACK ( I'm not sure ). So I think there is a problem when I send the slave adress of my EEPROM. Thinking that there is a problem in the order of the send, sending b0 at first or b7 at first. Datasheet of the 24C6 tell me to send b7 first. I will see that more precisly today See on the oscilloscope what I send on my EEPROM when I execute send7bitadress.

And I have my two pull-up resistor of 4,7kohm by 3,3V.

It's ##à@@#,§§ because I can't find the probleme and I don't know yet if I sending wwrong adress or if there is a problem on the EEPROM !! GRRRRRRR..

I will give you news about that !

Thanks

hervett
Associate II
Posted on May 17, 2011 at 12:55

Hi !

I don't think there is a problem with my EEPROM because when I disconnect the EEPROM The code is blocked on the checking of EV5, and when i connect the EEPROM, the checking of EV5 ( after the generation of the start ) is ok but still have problems for the checking of the EV6 !!