Shop OBEX P1 Docs P2 Docs Learn Events
Point Me to "Clear EEPROM" program — Parallax Forums

Point Me to "Clear EEPROM" program

LarryCardoLarryCardo Posts: 28
edited 2011-02-28 14:28 in Propeller 1
I understand there is a clear EEPROM program, but I can't find it.

Or maybe, just press F11 with a blank program??

Suggestions?

Larry Cardo
Mentor, OH

Comments

  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-02-25 13:59
    You can just use a program that has one public method with no code in it... Like

    pub main

    and then just press the F11 button...
  • LarryCardoLarryCardo Posts: 28
    edited 2011-02-25 16:04
    Thanks,

    My hair is gray. :(
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2011-02-25 20:47
    Ravenkallen--

    I am brand new to the Prop. I have also wondered how to "clear" EEPROM. (A servo cranking up when all I wanted to do is blink an LED might be surprising!)

    Thanks!

    --Bill
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-02-25 20:56
    No problem guys:)
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-02-25 21:24
    I am not sure that will clear the eeprom totally because the compiler sets the first few longs for the spin interpreter to run. However, if there is a binary around with all zeros or ones (not sure without checking if the eeprom cleared is 0 or 1), you could use proptool to just download and burn the binary. IIRC there is a checksum too so you may have to chek that out also.
    Otherwise, maybe someone has a simple program to clear it. It is not difficult - look for a spin I2C eeprom object.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-02-25 21:38
    Well, Cluso is right. I proabably should have mentioned that. It will not completely clear the EEPROM, but it will prevent any other code from being run. You load a program into the RAM(Using a I2C driver) that will literally write a 0 to every EEPROM address location. You would also have to use a program like that if you wanted to erase a EEPROM larger than 32Kilobytes. But, If all you want is to stop a program from running, than the above mentioned procedure will work.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-25 21:44
    It would be a very unusual situation where you would need to actually clear an EEPROM. In addition, the erased state of an EEPROM is all one bits, not zeros. If the object of the exercise is to prevent the Prop from running anything that might set the I/O pins to something unexpected, then what's been suggested so far will work (download a minimal program that doesn't do anything).
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2011-02-28 14:28
    I know this thread is a couple days old, but in case someone is searching the forum for a solution, here is another.
    Here is a method I use to erase the entire EEPROM: It uses the Basic or PASM I2C objects.

    With the Basic I2C object, it takes 20 seconds or so to execute. Using the PASM I2C object, it is about five times faster.
    PRI _errase | i, empty[16]
    '' errase EEPROM memory
    
      longfill(@empty, -1, 16)
    
      REPEAT i FROM $0 TO $7FFF STEP 64
        write(i, @empty, 64)
    
    PUB write (addr, valueAddr, size) | time
    '' write page to EEPROM with watchdog  
    
      IF i2c.WritePage(BootPin, EEPROM, addr, valueAddr, size)
        RETURN false
      time := cnt
      repeat while i2c.WriteWait(BootPin, EEPROM, addr)                             ' wait for watchdog
        if cnt - time > clkfreq / 10
          RETURN false
    
      RETURN true
    
Sign In or Register to comment.