Go Down

Topic: 24LC256 - wire library problem (Read 1 time) previous topic - next topic


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 :(


Sep 27, 2010, 10:12 am Last Edit: Sep 27, 2010, 10:21 am by mpeuser Reason: 1
(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?

When using Page Write mode, the addresses will roll-over at 64 byte bounderies, but that does not seem to be your issue.


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

This is what I used initially:

Code: [Select]

void Ext_Eprom_Set_Address(unsigned int Address){
 Wire.send((byte)(Address >> 8)); //       MSB
 Wire.send((byte)(Address & 0xFF)); //     LSB

When I had a problem I changed it to this:

Code: [Select]

void Ext_Eprom_Set_Address(unsigned int Address){
 byte tmp;
 byte = Address >> 8;
 Wire.send(tmp); //       MSB
 tmp = Address & 0xFF;
 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.

Go Up