I2C EEPROM

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
stewartbaker
Posts: 116
Joined: Tue Jul 17, 2012 9:34 am
Been thanked: 18 times
Contact:

I2C EEPROM

Post by stewartbaker »

To try and gain some understanding of I2C I have been playing with the EEPROM R/W example.

I have made a few small changes to make it easier for me to understand. However, there is one issue I have yet to get to the bottom of.

When reading then writing to my hardware EEPROM the contents are one location out. i.e the "H", "i" instead of being in locations 0 and 1 seem to be in locations 1 and 2. What am I missing ?

Cheers
Stewart
I2C EEPROM read and write.fcfx
(12.26 KiB) Downloaded 283 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: I2C EEPROM

Post by Benj »

Hi Stewart,

It looks like your doing everything correct to me so not sure why you are getting these results. What value pull up resistors are you using? Also for interest which specific I2C EEPROM device are you using?

stewartbaker
Posts: 116
Joined: Tue Jul 17, 2012 9:34 am
Been thanked: 18 times
Contact:

Re: I2C EEPROM

Post by stewartbaker »

Hi Benj,
The pull ups are both 1k, and the EEPROM is a 24C08WP. A0 is tied high, the other address pins low.

Looking with a logic analyser the first data read back is a NULL. Whether this is what was stored, or a misread I don't know.

Cheers
Stewart

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: I2C EEPROM

Post by Benj »

Hi Stewart,

Aha think I have spotted the issue. You are setting the internal address using two bytes but the device only has one address byte according to the datasheet. Therefore sending address LSB of 0 is actually writing 0 to the first EE location.

stewartbaker
Posts: 116
Joined: Tue Jul 17, 2012 9:34 am
Been thanked: 18 times
Contact:

Re: I2C EEPROM

Post by stewartbaker »

Ah !

That may well be the answer. I will try modified code tomorrow and let you know if that fixes it.

Many thanks

Stewart

stewartbaker
Posts: 116
Joined: Tue Jul 17, 2012 9:34 am
Been thanked: 18 times
Contact:

Re: I2C EEPROM

Post by stewartbaker »

That was the problem.

Many thanks

Stewart

Post Reply