Shop OBEX P1 Docs P2 Docs Learn Events
Non-Volatile Memory Write? — Parallax Forums

Non-Volatile Memory Write?

RICoderRICoder Posts: 91
edited 2009-02-21 13:49 in Propeller 1
Is there a way on the Prop to write some information to memory that will not be lost due to power-loss or reset? If so, how does one do this?

I promise, I searched the forums and google and the manual...but I just couldn't find anything, and I am hard pressed to believe this is not possible.

Comments

  • JasonDorieJasonDorie Posts: 1,930
    edited 2009-02-20 20:36
    You can write data to the EEPROM connected to the Prop by using the I2C object in the OBEX. If you have a variable in a DAT section, that variable will be at the same address in the EEPROM as it is in the Prop. If you write its value to the EEPROM at the same address, it'll be loaded automatically when the Prop is reset.

    Re-programming the Prop will erase anything stored within the first 32Kb, so if you have a larger EEPROM, you can write values above the 32Kb mark and just read them in 'manually' when the Prop is started instead.

    Jason
  • virtuPICvirtuPIC Posts: 193
    edited 2009-02-21 10:48
    Right. The prop's on chip memory is non-rewritable preprogrammed ROM and volatile SRAM that looses all data on power off. Typically you have some nonvolatile memory (EEPROM / FLASH) serially connected to the prop that holds your firmware. If this firmware needs less than the 32 KByte read at power on you can use the remainder for your data. But be aware that data in this memory is completely loaded into all cogs and will be executed at start up.

    I remember having seen a thread recently about connecting larger memory with spare space. And if you still have free pins in your application you can connect another memory chip to the prop. Or two or thre...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-02-21 13:49
    virtuPIC: That is not strictly correct...

    The I2C Eeprom connected to the prop (normally) holds 32KBytes (or more). An AT24C256 holds 32KB, an AT24C512 holds 64KB, and an AT24C1024 holds 128KB. On the Prop Proto Boards (I belive both versions) come with an AT24C512. The upper 32KB is free for the user to program and read - see the OBEX or other threads about this.

    Now, when the Prop boots, it checks the serial port and the I2C Eeprom (cannot remember which order). Anyway, if the I2C Eeprom exists, the first 32KB (B=Bytes) are loaded into hub ram and the code is executed. It may or may not load some of this hub memory into one or more cogs.

    When you load a program into the prop by PropTool, your code is loaded into hub ram and anything not loaded is cleared. If you tell the PropTool to burn this into Eeprom, the whole 32KB just loaded into hub ram is burn (written) to the eeprom. So, effectively, anything you have coded into your software and loaded into the prop by PropTool and burnt to eeprom, will be loaded next time power is applied.

    Now, you can also write to sections of the lower 32KB in eeprom, and it will be read into hub each time the prop is reset (or re-powered). Just make sure you don't overwrite any code in the eeprom.

    I hope this helps smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps (SixBladeProp)
    · Prop Tools under Development or Completed (Index)
    · Emulators (Micros eg Altair, and Terminals eg VT100) - index
    · Search the Propeller forums (via Google)

    My cruising website is: ·www.bluemagic.biz
Sign In or Register to comment.