Pages: [1]   Go Down
Author Topic: 24LC256 - wire library problem  (Read 664 times)
0 Members and 1 Guest are viewing this topic.
Right Here!
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the first time I've used this EEPROM chip so I might be overlooking something.

It seems that I can only set addresses in multiples of 16 - i.e. bottom 4 bits ignored. I've hunted all over the place for data on the chip but nothing mentions this, so I don't know if I'm doing something wrong, or if I've been unlucky enough to have a faulty chip.

When setting the address, I've made sure I am definitely sending all bits in MSB -LSB form.


Once the address is set, I have no trouble reading sequential bytes, even stepping through the addresses I can't directly set.

The other rather irritating problem has been mentioned here before I think. That is the size of the buffer. 32 bytes includes the  writing address so you actually only get to send 30 bytes, this is an incredibly awkward number to handle smiley-sad

Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

(1) Your "multiples of 16 issue" is funny... A bug in your code?
(2) You can easily increase the buffer size in the Wire lib if you wish. But why?

Edit:
----
When using Page Write mode, the addresses will roll-over at 64 byte bounderies, but that does not seem to be your issue.
« Last Edit: September 27, 2010, 03:21:10 am by mpeuser » Logged

Right Here!
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm as sure as I can be that there is no problem with my code.

This is what I used initially:

Code:
void Ext_Eprom_Set_Address(unsigned int Address){
  Wire.beginTransmission(DISK_1);
  Wire.send((byte)(Address >> 8)); //       MSB
  Wire.send((byte)(Address & 0xFF)); //     LSB
}
When I had a problem I changed it to this:

Code:
void Ext_Eprom_Set_Address(unsigned int Address){
  byte tmp;
  Wire.beginTransmission(DISK_1);
  byte = Address >> 8;
  Serial.println(tmp);
  Wire.send(tmp); //       MSB
  tmp = Address & 0xFF;
  Serial.println(tmp);
  Wire.send(tmp); //     LSB
}

The serial data was correctly showing the two bytes, but still the addressing was wrong - exactly as before.

I'm sending long integers so a usable buffer that's a multiple of 4 bytes is highly desirable.

I was aware of the 64byte paging, but as you say this is not relevant here. If I could use the 20byte (5 longs) format that I want, all the problems would go away.
Logged

Pages: [1]   Go Up
Jump to: