EEPROM functions always return 0

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
aleconakad
Posts: 68
Joined: 18 Jan 2016 15:25

EEPROM functions always return 0

Post by aleconakad »

Hi,

using Z-Uno2 3.0.7, I have simple program that writes data to EEPROM, then reads out then compare it to verify if the write operation was successfull.

I use mainly read and write bulk operations, like put and get. I can confirm that the data has been written correctly to the EEPROM. the only issue is that the put and get functions always return 0, which results to false checks in my code. This behaviour is NOT compatible with Z-Uno first GEN.

Here's a code snippet:

Code: Select all

if (EEPROM.put(addr, &write_array, asize))
    Serial.println("Flashing success");
  else {
    Serial.println("Flashing failed");
  }

....

  if (EEPROM.get(addr, &read_array, asize*usize))
    Serial.println("EEPROM Read: success");
  else {
    Serial.println("EEPROM Read: failure");
    return;
  }
Same behaviour in 3.0.8beta
joergm6
Posts: 24
Joined: 03 Nov 2016 21:16

Re: EEPROM functions always return 0

Post by joergm6 »

An example looks like this, but is equal to the V1.

Code: Select all

    Serial.println("Reading buffer from EEPROM...");
    res = EEPROM.get(addr, &read_data, sizeof(read_data));
    Serial.print("Read ");
    Serial.print(res);
    Serial.println(" Bytes");

    // write data to a specific address
    res = EEPROM.put(addr, &some_data, sizeof(some_data));
aleconakad
Posts: 68
Joined: 18 Jan 2016 15:25

Re: EEPROM functions always return 0

Post by aleconakad »

Hi joergm6,

what is the output of the code snippet above?

In my case it is:

Code: Select all

13:04:57.218 -> Reading 128 Bytes one by one from EEPROM...
13:04:57.218 -> AA BB CC DD EE FF FF FF FF FF FF FF FF FF FF FF FF
13:04:57.218 -> FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 3C
13:04:57.251 -> 0 64 0 0 55 0 0 55 0 0 0 0 55 0 0 55
13:04:57.251 -> 55 0 0 55 0 0 0 0 55 0 0 55 55 0 0 55
13:04:57.251 -> 0 0 0 0 55 0 0 55 55 0 0 55 0 0 0 0
13:04:57.251 -> 55 0 0 55 55 0 0 55 0 0 0 0 55 0 0 55
13:04:57.251 -> 55 0 0 55 0 0 0 0 55 0 0 55 55 0 0 0
13:04:57.251 -> 0 0 55 0 0 0 0 0 55 0 0 0 0 0 0 
13:04:57.251 -> Reading buffer from EEPROM...
13:04:57.285 -> Read 0 Bytes
compared to Zuno 1G, the results look lie this:

Code: Select all

13:11:53.740 -> Reading 128 Bytes one by one from EEPROM...
13:11:53.740 -> AA BB CC DD EE 55 11 26 55 12 25 54 13 24 54 14 23
13:11:53.740 -> 53 15 22 52 16 21 52 17 20 51 17 1F 51 18 1E 3C
13:11:53.778 -> 0 64 0 0 55 0 0 55 0 0 0 0 55 0 0 55
13:11:53.778 -> 55 0 0 55 0 0 0 0 55 0 0 55 55 0 0 55
13:11:53.815 -> 0 0 0 0 55 0 0 55 55 0 0 55 0 0 0 0
13:11:53.815 -> 55 0 0 55 55 0 0 55 0 0 0 0 55 0 0 55
13:11:53.815 -> 55 0 0 55 0 0 0 0 55 0 0 55 55 0 0 0
13:11:53.851 -> 0 0 55 0 0 0 0 0 55 0 0 0 0 0 0 
13:11:53.851 -> Reading buffer from EEPROM...
13:11:53.851 -> Read 1 Bytes
It seems that the function return 1 instead of 0. what does this `1` mean is something that the creators should be able to answer :-)
Post Reply