Variable Persistence after power failure
xanatos
Posts: 1,120
The EEPROM DATA in the BS2SX is nonvolatile, correct?· If I store data there, it will still be there following a power failure, I'm guessing, since the program stays.· I just want to be sure I can write data TO EEPROM on the fly, and if power fails, the data collected by my program will still be available once power returns.
In a related question - does anyone know if the PINK Server's variables 00 to 19 can be written NONVOLATILE (ie., to flash) from the web interface?· I can set a default value from the PINK Setup utility, but can the nonvolatile flash contents be written from my own web page, or only the RAM?
Thanks again!!!
Dave
·
In a related question - does anyone know if the PINK Server's variables 00 to 19 can be written NONVOLATILE (ie., to flash) from the web interface?· I can set a default value from the PINK Setup utility, but can the nonvolatile flash contents be written from my own web page, or only the RAM?
Thanks again!!!
Dave
·
Comments
Read the PINK Manual. It clearly shows how to read and write the variables from the Stamp and from the web pages. The values of the first 20 variables are stored in flash as the Manual states, regardless of whether they're written from the Stamp or a web page.
Post Edited (Mike Green) : 6/23/2009 9:03:50 PM GMT
Dvae
From the manual:
...The first 20 general purpose variables (0 through 19) can be written to flash memory
as power-on defaults. The remaining general purpose variables (20 through 99) are RAM variables only and the
data is lost when power is cycled...
...All variables can be accessed and modified through the Modify Variables web interface by browsing to
XXX.XXX.XXX.XXX/VV_Show.htm ... Only
from this page can you set the default values for those variables which can be set to default (written to flash)
by clicking the link to the right of the variable (Set Default Value).
Reviewing the source code on the VV_Show.htm page shows the link to the page to change a default flash variable: VV_Default.htm?08 (where 08 is the variable number to be edited)
Reviewing the source code on that page shows a form action of DEFAULTSET.HTM which must be accessed to set the flash default for any given variable. This page is set to get data only via a form post. I tried a get-style URL request using the input names in the form ( DEFAULTSET.HTM?variable_name=08&NewVal=TESTING ) as well as attempting to access the page DEFAULTSET.HTM directly, and both attempts show "Page not found", despite the fact that accessing the default variable setting routine from the page it is supposed to be set from does indeed work.
So I believe that the actual answer is that you cannot, in fact, write a web page of your own that sets the default value of one of the first 20 variables, but can only set the RAM value for those variables, meaning data in those variables returns to default on power cycling.
Am I wrong in this?
Dave
I'm sorry if I seem thick, but the manual is at odds with the documentation embedded on the PINK server itself. The server page VV_Show.htm clearly states that the only way to alter the FLASH content for variables 0 through 19 is from THAT page, but that the RAM values of those same variables may be edited from a constructed HTML page. I'm already quite successfully altering the RAM values of 44 of the RAM values of the variables on the PINK, but they do not persist when power cycles. I can hard-set the flash/default value with the VV_Show.htm page that is resident on the PINK server, and when power cycles, whatever RAM value was in there gets replaced by the flash-programmed value. What I seem unable to actually do is to make a persistent change in teh FLASH value with a constructed HTML page, despite my being able to edit the RAM value of that variable with ease.
Am I not stating my situation properly? I am looking at page 7 of the manual right now, and all I can see is the information used to change the RAM values in NB01 and NB02 - but this code does not alter the FLASH/Default/Power-on value of NB01 or NB02. This is the type of code I am already using extensively. But there seems to be something entirely different to changing the power-on default value of the Flash variable. That's probably why the VV_Show.htm page has two separate links for setting values - one for RAM, teh other for Flash. I need to know how they set flash...
I'm hoping I've worded this well enough, I really need this function!
Thanks very much,
Dave
PS., Here's the code I have used to VERIFY that while I can easily set the value of NB_var02 using this code, it does nothing to alter the flash value when power is cycled:
<HTML><HEAD><TITLE>Flash Write Test</TITLE></HEAD>
<BODY><FORM ACTION="FlashWrite.htm" METHOD="POST">
<P><B>02:</B> <Nb_var02></P>
<INPUT NAME="Nb_var02" MAXLENGTH=64>
<INPUT TYPE="submit" VALUE="Accept">
</FORM></BODY></HTML>
If you run this code on the PINK Server, you will see the variable does get set properly. Power the PINK Server down, wait 5 seconds or so, and power it back up, and the setting is gone, and it's back top whatever you had set in the DEFAULT flash variable. It's very frustrating, there MUST be a way to write to nonvolatile memory from a web page OTHER than teh embedded VV_Show.htm page..............
I think the Parallax call will be in order. I have already followed up on the code in the VV_Show.htm page. Here's an excerpt from one of my earlier posts in this thread:
Reviewing the source code on the VV_Show.htm page shows the link to the page to change a default flash variable: VV_Default.htm?08 (where 08 is the variable number to be edited)
Reviewing the source code on that page shows a form action of DEFAULTSET.HTM which must be accessed to set the flash default for any given variable. This page is set to get data only via a form post. I tried a get-style URL request using the input names in the form ( DEFAULTSET.HTM?variable_name=08&NewVal=TESTING ) as well as attempting to access the page DEFAULTSET.HTM directly, and both attempts show "Page not found", despite the fact that accessing the default variable setting routine from the page it is supposed to be set from does indeed work.
So... unless someone else jumps in... A call to Parallax it is.
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=216188
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=138416
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=95093
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=95511
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=109655
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=112348
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=95051
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=253894
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=276739
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=94845
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=150604
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=284136#m290104
http://forums.parallax.com/forums/default.aspx?f=5&p=1&m=276906
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thanks for the input. That listing of links is great, lots of good info in there! Unfortunately, I am thinking at this point and given the time constraints I am under that attempting to store persistent data on the flash via writes from the BS2sx is just not going to happen. The PINK seems to tie that function STRICTLY to the embedded factory-default setup pages - it seems that the PINK knows if a variable set command is not coming from those pages, even using teh form actions and variable names from the flash-set page itself.... When and if I pick this idea up again, if I find anything useful, I will post it here. Apparently there have been a few people who would have liked to write on-the-fly to the flash for those variables. For me, it would have been a great way to maintain data in the event of a power failure. Other options still exist, however.
Thanks again all,
Dave X
Backing up to your original question about writing to the EEPROM on the fly on the BS2sx, you should be aware that if you’re updating variables in real-time your EEPROM won’t last very long. Could be hours/days/weeks depending on how often data is written to it. On the other hand if you store this data into a BBRTC w/RAM you can keep refreshing the data as often as you like. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
I did see that the BS2SX only has a 100K write lifespan, but the average write frequency will be more likely along the lines of 1x per hour, and that gives me an 11+ year chip lifespan. These guys will be controlling the status of a drive-in bay rental, most rentals will be in the neighborhood of 6 to 12 hours, and probably no more than 12 to 25 bays for a controller (if I use the the 2p40). Thanks for the heads up though! It's odd that the regular BS2 does 10M writes, but the 2sx only does 100K. Must be smaller individual memory cells...???
Best,
Dave
Dave
Yes, the DS1302 is a perfect example and I have used it in designs where I did not need the time or date but did need reliable battery backed variables. I have listed example routines for randomly writing variables to the DS1302 RAM in the DS1302 Demo Code in the Completed Projects Forum. I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering