Shop OBEX P1 Docs P2 Docs Learn Events
Propeller losing program... — Parallax Forums

Propeller losing program...

rapscaLLionrapscaLLion Posts: 75
edited 2007-06-05 08:54 in Propeller 1
Hi folks,

I've been having a problem with my propellor demo/proto boards, which I conclude must be a software issue.
Basically, I load the program, it works perfectly, runs fine, etc. If I reset, turn off/on, remove power, etc, the
program still works fine. However if the board is off for a few hours or more, the program seems to be lost
when I turn it back on. The propeller simply does not respond, as if the EEPROM is blank. As far as I can tell
this is not the case with other programs, so I assume there must be a problem with my EEPROM read/write
functions embedded in the program. Could I be leaving the EEPROM in an invalid state or something?

The relevent code sections are below:

  ' Initialize EEPROM
  outa[noparse][[/noparse]28] := 1 ' set SCL high
  dira[noparse][[/noparse]28] := 1
  dira[noparse][[/noparse]29] := 0 ' set SDA as input
  repeat 9 ' up to 9 cycles
    outa[noparse][[/noparse]28] := 0 ' put out a clock pulse
    outa[noparse][[/noparse]28] := 1
    if ina[noparse][[/noparse]29] ' if SDA is not high, repeat
      quit

'read
PRI readIt(eepromAddress)
   ee.i2cReadPage(pinNumber, ee#i2cEEPROM, eepromAddress, @buffer, 4)

'write
PRI writeIt(eepromAddress)   | startTime
   if ee.i2cWritePage(pinNumber, ee#i2cEEPROM, eepromAddress, @buffer, 4)
     'abort ' an error occured during the write
   startTime := cnt ' prepare to check for a timeout
   repeat while ee.i2cWriteWait(pinNumber, ee#i2cEEPROM, eepromAddress)
     if cnt - startTime > clkfreq / 10
       abort ' waited more than a 1/10 second for the write to finish




The functions work fine and EEPROM values are saved and read within the program,
and can still be read properly when the board is reset. However a few hours without
power and the EEPROM seems to lose everything.


Any ideas?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-04 15:49
    What you describe does not happen. If you truly can turn off the power, wait for a couple of minutes for the power to "go away", turn on power again, and everything works fine, but a long delay (on the order of hours) does not work (due to something wrong in the EEPROM), it doesn't make sense. What you've posted doesn't show which EEPROM locations you're writing (and reading). If you're turning off the power when this program is writing to the EEPROM, it's possible that it might be overwriting some other location by mistake.

    The EEPROMs are designed to hold their data for at least 20 years, won't write if the power supply voltage is too low to complete the write cycle. Both the Demo Board and the Protoboard have large capacitors across the voltage regulators that will maintain the supply voltage for quite some time after the input source is disconnected, certainly long enough for the EEPROM to finish its cycle and the Propeller has a "brown-out" circuit on the chip that will cause it to stop executing long before the supply voltage is too low for proper functioning.

    Anyway, what you suggest doesn't make sense and you've not given enough information to begin to figure out what's really happening. You'll need to post your program (as an attachment) and include a schematic of what's connected to your Prop board (or a thorough description).
  • rapscaLLionrapscaLLion Posts: 75
    edited 2007-06-04 16:08
    I figured as much. Will give more details when I get back home later today.
  • simonlsimonl Posts: 866
    edited 2007-06-05 08:54
    rapscaLLion, are you doing F10, or F11, in the IDE? It's just possible that, if you're doing F10, the board's capacitors are holding enough voltage to keep your programme in RAM for a short while?

    Sorry if the F10/11 thing's teaching you to 'suck eggs'.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon
    www.norfolkhelicopterclub.co.uk
    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
    BTW: I type as I'm thinking, so please don't take any offense at my writing style smile.gif
Sign In or Register to comment.