Shop OBEX P1 Docs P2 Docs Learn Events
Clearing ram and eeprom — Parallax Forums

Clearing ram and eeprom

On the wx board or the earlier activity board. Any body have a problem with
clearing the ram and eeprom with Prop tool or spin tools IDE?
Thanks.
Martin
I have to unplug power and usb then restart from scratch.
Weird

Comments

  • RaymanRayman Posts: 16,037
    edited 2026-02-15 14:07

    Wait this is P1. Should be pretty solid …

    Sometimes PST can capture the port though…

  • pilot0315pilot0315 Posts: 970
    edited 2026-02-15 17:45

    @Rayman
    @jeromelab

    I am using a PCA9685 to run mg995r servos that use 5 v signal which the p1 does
    not provide. When I reset or turn off the p1 and turn the P1 back on no code loaded
    the pca9685 continues to run.
    This is weird. Do you have any experience with this board?
    Thanks
    I looked and did not see an eeprom on the pca. That is the only thing I could
    think of.
    Martin
    But when I run parallax servos off of the P1 boards and reset or shut off every thing needs
    to be reloaded as usual.

  • JonnyMacJonnyMac Posts: 9,655
    edited 2026-02-15 20:09

    Did you download your program with F11? That would put it into the EEPROM which will auto-load next time the P1 resets.

    I use this to wipe the P1 EEPROM. Yes, this is the entire program -- nothing else is needed.

    pub main
    
      repeat
        waitcnt(0)
    

    This needs to be downloaded with F11 for the EEPROM to be cleared. After that, running experiments with F10 will leave the EEPROM (and IO configuration) clear after subsequent resets.

    Here's the F8 memory map that shows that other than the harmless repeat loop, the EE is clear.

  • RaymanRayman Posts: 16,037

    @pilot0315 does sound like you are booting with eeprom, which is why things are still happening…

    Almost seems like there should be a “clear eeprom” menu option …

  • JonnyMacJonnyMac Posts: 9,655
    edited 2026-02-15 23:23

    Was hoping to add an custom tool to Spin Tools but spinc.exe doesn't work as a loader for pre-compiled code (I will verify with Marco). Maybe the loader from FlexProp could be used.

  • RaymanRayman Posts: 16,037

    Do wonder if there is a slight difference between minimal program in eeprom and no program in eeprom…

    Maybe the later will wait longer for serial or something?

  • JonnyMacJonnyMac Posts: 9,655
    edited 2026-02-16 01:14

    Having an empty program works, too. I downloaded this to EEPROM and then tried to load another program to RAM. Everything was fine.

    Spin Tools and Propeller Tool produce the same output for blank program. The nice thing about Spin Tools is the built-in list file display

  • The reason the empty program works has to do with those mysterious F9 and FF bytes past the end of the program. These are the initial stack frame for the main method. When it returns, it returns to $FFF9 in ROM, which contains the bytecodes for cogstop(cogid)

  • RaymanRayman Posts: 16,037

    Think a really empty eeprom will read all $ff

  • Think a really empty eeprom will read all $ff

    A factory-fresh or erased EE is, yes (all $FF). Since the P1 loads the EE into RAM, it clears everything to $00 so that variables have no value when the program starts.

    The attached program "erases" the EEPROM. Most P1 devices from Parallax user the 64K EE so that's the object I used. When I run (from RAM) I get.

    This uses a PASM cog for I2C to make it as fast as possible. In this case, it erases the entire 64K EE on the FLiP in about 4 seconds (takes about 30 seconds with Spin I2C).

    I pressed the reset button on the board, then tried to download a new program. As expected, no problem. In our laser tag devices we sometimes run an erase on the upper EE to force the next version of the program to rebuild the non-volatile data space -- I'm going through that now with a game piece.

    In another thread I asked Marco about adding a loader function for an existing binary to spinc.exe. He says he'll do that. It will simplify running EE/Flash erase programs from the Tools menu. I think this is the most flexible option versus adding it as a feature to Spin Tools. Doing it externally, we have control over what part of the P1 gets erased.

Sign In or Register to comment.