EEPROM example code not working properly

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
graham
Posts: 4
Joined: 14 Jul 2022 22:15

EEPROM example code not working properly

Post by graham »

I am trying to write to the EEPROM to save data during power cycles. Just to test our that the EEPROM works properly, I used the example code on https://z-uno.z-wave.me/Reference/EEPROM/. Nothing gets stored in the EEPROM, just 0's. In addition I have tried to use EEPROM.write to write directly to a specific memory address and the entire memory is filled instead of just one memory location. Furthermore, when I cycle power nothing is saved. Any help would be appreciated. I am using a Z-uno2 rev.6

Code: Select all

#include "EEPROM.h"

BYTE some_data[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee}; 
BYTE read_data[5];

void setup() {
  Serial.begin();
}

void loop() {
    byte i;
    word res;
    dword addr = 0x0;
    
    Serial.println("Reading 128 Bytes one by one from EEPROM...");
    for (i = 0; i < 128; i++) {
        Serial.print(EEPROM.read(addr + i),HEX);
        if (((i % 0x10) == 0) && (i != 0))
          Serial.println();
        else
          Serial.print(' ');
    }

    Serial.println();

    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));
    
    delay(5000); // don't write to much in the EEPROM not to kill it
}
amatilda
Posts: 61
Joined: 26 Sep 2021 22:09

Re: EEPROM example code not working properly

Post by amatilda »

Hello.

Can you show the console output?
graham
Posts: 4
Joined: 14 Jul 2022 22:15

Re: EEPROM example code not working properly

Post by graham »

hi, here is the console output...
Attachments
Capture.PNG
Capture.PNG (7.57 KiB) Viewed 2597 times
joergm6
Posts: 24
Joined: 03 Nov 2016 21:16

Re: EEPROM example code not working properly

Post by joergm6 »

Which software version do you use? With larger v 3.0.7 an EEPROM problem was fixed.
graham
Posts: 4
Joined: 14 Jul 2022 22:15

Re: EEPROM example code not working properly

Post by graham »

Hi,
I am using Arduino IDE v 1.8.19, not sure if that is what you are asking for.
joergm6
Posts: 24
Joined: 03 Nov 2016 21:16

Re: EEPROM example code not working properly

Post by joergm6 »

no, the Z-uno2 version in "Boards Manager" ... https://z-uno.z-wave.me/arduino-install/
amatilda
Posts: 61
Joined: 26 Sep 2021 22:09

Re: EEPROM example code not working properly

Post by amatilda »

on v 3.0.9 it works fine so maybe you should update the software - probably this will fix the problem
graham
Posts: 4
Joined: 14 Jul 2022 22:15

Re: EEPROM example code not working properly

Post by graham »

That fixed it! I wasn't using the Beta board, that was my issue.
7Cv0Nu6Q
Posts: 6
Joined: 22 Aug 2022 17:11

Re: EEPROM example code not working properly

Post by 7Cv0Nu6Q »

It would be really helpful to mention this serious EEPROM issue here: https://z-uno.z-wave.me/arduino-install/
I spent a whole day trying to get config channels to work - always got completely wrong values from the EEPROM.
With 3.0.9 everything now works like a charm - this information could have saved me (and potentially many others) a lot of time and nerves!
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: EEPROM example code not working properly

Post by PoltoS »

The first rule in all debugging is "upgrade to the latest version" :)

Indeed, we have not made 3.0.9 public. I;ll make sure it become public by the next week. Sorry for the inconvenience
Post Reply