EEPROM in D21G

I'm trying to use all the 4x 256byte eeproms in the D21G, but i can access correctly only the first address (0x50).

Here is the code:

#include "I2C_eeprom.h"

#define EEPROM_SIZE 256

I2C_eeprom eeprom50(0x50, EEPROM_SIZE);
I2C_eeprom eeprom51(0x51, EEPROM_SIZE);
I2C_eeprom eeprom52(0x52, EEPROM_SIZE);
I2C_eeprom eeprom53(0x53, EEPROM_SIZE);

void setup() {

  SerialUSB.println(eeprom50.readByte(0));  //return the correct value

  SerialUSB.println(eeprom51.readByte(0));  //return wrong value

  SerialUSB.println(eeprom52.readByte(0));  //return wrong value

  SerialUSB.println(eeprom53.readByte(0));  //return wrong value

}

I'm doing something wrong? 

It's a D21G REV1.7 R1.7-1815 R00002396.

Enrico Michieletti
Enrico Michieletti
95
| 3 1 2
Asked on 12/25/20, 5:11 PM
0
vote
1388 Views

The eeprom chip is a 256*4 (from 0 to 255), and in any case i was testing well under the max size.

I've also wrote a library that can write anything (any data type) and it automatically span the data over the 4 eeproms if in overlaping address, but as for now i'm not able neither to use the base library. 

Next step is try to load the sample eeprom test sketch as-is and see if it work...

------------------------

I can confirm that with the sample sketch all works as it should.

Funny thing, after have seen that the example sketch worked, i've retested the addresses >0x50 with my sketch, and this time all worked. I can't explain what's changed in the last 20 days, i've update some libraries (also the "core" ones under the "Arduino15\packages\industruino\hardware\samd" folder, updated version taken from GitHub 1.0.2, i was using 1.0.1 installed with arduino)

Enrico Michieletti
Enrico Michieletti
95
| 3 1 2
Answered on 1/19/21, 12:28 PM
0
vote

Hi Enrico,

First, I seem to remember the EEPROM_SIZE is 255 max

Then you have to start your EEPROM with a : eeprom50.begin();

Then you can writebyte / readbyte as you want. I wrote an extension of I2C_eeprom to simplify the EEPROM operations, Comments in french (not translated yet, so not available on github for now), but let me know if you want  a copy.

Hope this helps

Didier, DG2R

Didier DORGUIN
Didier DORGUIN
172
| 4 1 3
Answered on 1/18/21, 8:04 PM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

63 follower(s)

Stats

Asked: 12/25/20, 5:11 PM
Seen: 1388 times
Last updated: 1/20/21, 9:21 PM