Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I2C 24xx64.pde example problem
14-01-2014, 08:46 PM,
#1
I2C 24xx64.pde example problem
Hi all,
I'm trying to use i2c eeprom 24lc512 (64k) using 24xx64.pde sample.
But there is a problem about compilation step on line

Code:
I2C.send(wBuffer[i]);

May be
Code:
I2C.write(wBuffer[i]);

Bye.
Reply
15-01-2014, 09:42 AM, (This post was last modified: 15-01-2014, 09:42 AM by dkmorb.)
#2
RE: I2C 24xx64.pde example problem
Another question: could someone explain me how to fill the 64k memory by a for cycle?

Thanks!
Reply
15-01-2014, 09:45 AM,
#3
RE: I2C 24xx64.pde example problem
in p8/pdl/i2c.pdl, I can see :

I2C.write I2C_write#include <i2c.c>
I2C.send I2C_printf#include <i2c.c>

They will now point both on I2C_write.
I've also changed I2C.send to I2C.write in the example.
Thanks for this report.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
15-01-2014, 08:46 PM,
#4
RE: I2C 24xx64.pde example problem
(15-01-2014, 09:45 AM)regis Wrote: I've also changed I2C.send to I2C.write in the example.
Thanks for this report.

No answer to my previous question?
Reply
15-01-2014, 09:21 PM, (This post was last modified: 15-01-2014, 09:28 PM by regis.)
#5
RE: I2C 24xx64.pde example problem
What do you mean by "by a for cycle ?"
If you need to fill the whole space then you have to write pages.
Datasheet : http://pdf.datasheetcatalog.com/datashee...oykg3y.pdf
See 6.2 Page Write
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
16-01-2014, 07:24 PM,
#6
RE: I2C 24xx64.pde example problem
(15-01-2014, 09:21 PM)regis Wrote: What do you mean by "by a for cycle ?"
If you need to fill the whole space then you have to write pages.
Datasheet : http://pdf.datasheetcatalog.com/datashee...oykg3y.pdf
See 6.2 Page Write

Hi regis,
I attached my code to show you what I made.
But there is something wrong...I don't know what, 'cause is my first experience with I2C protocol and eeprom Blush .

Thanks in advance!


Attached Files
.pde   24xx512.pde (Size: 5.05 KB / Downloads: 9)
Reply
17-01-2014, 10:04 AM,
#7
RE: I2C 24xx64.pde example problem
I think there's an error in your read function because before reading the memory you must write the address memory to be read.

You do :
I2C.start();
I2C.write((i2cAddr << 1) + 1); // read
I2C.write(Hi_addr);
I2C.write(Lo_addr);
temp = I2C.read();

You should first do :
I2C.start();
I2C.write((i2cAddr << 1) & 0xFE); // write
I2C.write(Hi_addr);
I2C.write(Lo_addr);

and then start reading with :
I2C.start();
I2C.write((i2cAddr << 1) + 1); // read
temp = I2C.read();

Please, take a look at the example 24xx64.pde
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
19-01-2014, 11:11 PM,
#8
RE: I2C 24xx64.pde example problem
(17-01-2014, 10:04 AM)regis Wrote: You should first do :
I2C.start();
I2C.write((i2cAddr << 1) & 0xFE); // write
I2C.write(Hi_addr);
I2C.write(Lo_addr);

and then start reading with :
I2C.start();
I2C.write((i2cAddr << 1) + 1); // read
temp = I2C.read();

Regis,
it works!!! Thank you!
Just a note: I have read in the wiki I2C library pages:
Quote:The current implementation of the I2C library (June 2012) only allows single master operation and does not support either multi-master or slave modes.

So, I can't connect two devices as slaves (example: a 1307 RTC and a 24LC512) together?

Bye.
Reply
20-01-2014, 10:12 AM,
#9
RE: I2C 24xx64.pde example problem
(19-01-2014, 11:11 PM)dkmorb Wrote: Just a note: I have read in the wiki I2C library pages:
Quote:The current implementation of the I2C library (June 2012) only allows single master operation and does not support either multi-master or slave modes.
So, I can't connect two devices as slaves (example: a 1307 RTC and a 24LC512) together?

Then the Wiki is out dated at least for the slave mode, thanks to André.
Take a look at his examples in 04.Communication/i2c/slave.pde, slave_reader.pde and slave_transmitter.pde.
May I count on you to update the Wiki and maybe add your program as an example ?
The multi-master mode is still to do Wink.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)