Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: EEPROM issues

  1. #1
    Junior Member daniel-arg's Avatar
    Join Date
    Jul 2013
    Location
    Paris
    Posts
    8

    EEPROM issues

    HEllo

    I had 2 Teensy that has EEPROM issues, I don't make a very intensive use of it, mainly storing config parameters, readed at boot time, than wrote once or twice per run.

    The issue is that the device freezes on EEPROM read.

    Is the lifetime of the EEPROM that short?
    Is there a 'best practice' to use EEPROM?

    Finally, is there a way to get a new device to replace those 2 that are partially unusable?

    Any clue on this will be helpful.

    Cheers, and thank you

    Daniel

  2. #2
    Senior Member
    Join Date
    Nov 2015
    Location
    Wales
    Posts
    579
    Can you elaborate on EEPROM issues?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,327
    Quote Originally Posted by daniel-arg View Post
    The issue is that the device freezes on EEPROM read.

    Is the lifetime of the EEPROM that short?
    No, the EEPROM should definitely not fail in such a short time.

    Even when it does eventually fail, the failure mode will be wrong data, not freezing your program (unless your program is written in such a way that is freezes when given wrong data).

    Something else is wrong here. What, nobody can even begin to guess, since we have so little info other than "device freezes on EEPROM read".

  4. #4
    Junior Member daniel-arg's Avatar
    Join Date
    Jul 2013
    Location
    Paris
    Posts
    8
    Quote Originally Posted by PaulStoffregen View Post
    No, the EEPROM should definitely not fail in such a short time.

    Even when it does eventually fail, the failure mode will be wrong data, not freezing your program (unless your program is written in such a way that is freezes when given wrong data).

    Something else is wrong here. What, nobody can even begin to guess, since we have so little info other than "device freezes on EEPROM read".
    Thanks for your quick answer.
    I'll double check my code. What's is strange is that the same code on 2 identical devices, one freezes the other don't.
    Anyway, as per your comments, I may be doing something wrong

  5. #5
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    Quote Originally Posted by daniel-arg View Post
    I may be doing something wrong
    yes, you did not post any code ;-)

  6. #6
    Junior Member daniel-arg's Avatar
    Join Date
    Jul 2013
    Location
    Paris
    Posts
    8
    Quote Originally Posted by Headroom View Post
    yes, you did not post any code ;-)
    What a useful comment!


    Here is my code:

    #include <EEPROM.h>
    int cycle=0;

    void setup() {
    // put your setup code here, to run once:
    Serial.begin(9600);
    delay(3000);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    char c;
    Serial.print("Cycle ");
    Serial.println(cycle++);
    delay(3000);
    for (int e = 0; e < 256; e++) {
    c = EEPROM.read(e);
    if (c < 0x10) {
    Serial.print('0');
    }
    Serial.print(c, HEX);
    Serial.print(" ");
    if((e+1)%16==0) Serial.println(" ");
    EEPROM.write(e,e);
    }
    Serial.println(" ");
    delay(3000);
    Serial.println("Restart");
    }


    On device #1, the result is the following, and the Teensy freezes

    Click image for larger version. 

Name:	Device1.png 
Views:	67 
Size:	18.1 KB 
ID:	7029

    On device #2, the result is the following, and it iterates undefinitely
    Click image for larger version. 

Name:	Device2.png 
Views:	87 
Size:	46.8 KB 
ID:	7028

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,327
    Could you try adding this at the beginning of loop()?

    Code:
      Serial.println(FTFL_FCNFG, HEX);
    Does it print something different on each board?

  8. #8
    Junior Member daniel-arg's Avatar
    Join Date
    Jul 2013
    Location
    Paris
    Posts
    8
    Quote Originally Posted by PaulStoffregen View Post
    Could you try adding this at the beginning of loop()?

    Code:
      Serial.println(FTFL_FCNFG, HEX);
    Does it print something different on each board?
    Same for both devices: it prints 1

  9. #9
    Senior Member
    Join Date
    Nov 2015
    Location
    Wales
    Posts
    579
    Can you use an interval timer interrupt to toggle a pin/LED to see if the entire device is freezing?

    I can't seem to find any blocking code in the EEPROM library

  10. #10
    Senior Member jimmayhugh's Avatar
    Join Date
    Nov 2012
    Posts
    168
    First thing I'd do is comment out the EEPROM.write call to see if the problem occurs during a read or a write.

  11. #11
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,327
    Quote Originally Posted by daniel-arg View Post
    Same for both devices: it prints 1
    Same here, when I ran it on a Teensy 3.2. At least that rules out the FlexNVM memory not getting configured into EEPROM mode, which is really the only thing that could be expected stall.

    Is it possible something entirely unrelated is happening here, but just seems like it might be the EEPROM memory? Are either of these boards being tested with connections to other hardware?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •