Storing user setup

I have several user entered parameters to store (integer values), such as
maxTime (time limit)
tripVoltage
maxSpeed
SoundLevel

These are to be restored upon power up…this is on a Cobra board…I think it should use EWR, but not sure. The posts I see generally say it doesn’t work, or there are multiple problems in getting it to work,as though its an ongoing issue. Does it really work & are there examples that do restore the values properly?

See PersistentStorage class

http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation/Index.html

What about this nice utility (includes sample project for Cobra):
http://code.tinyclr.com/project/444/ini-file-settings-utility/

[quote]What about this nice utility (includes sample project for Cobra):
[/quote]

The utility allows you to:

  • LoadSettings from SD card
  • SaveSettings to SD card

Ummm… thanks but this link was for storing files on an SD card . I’m not interested in an SD card, just storing the values of a few integer variables on the board or processor memory, so that at power up these user values will be restored. This is probably 50 bytes worth of setup information. I’d expect some sort of write/store routine & a read routine that could be used at some point in the program.

EWR is the way!

follow the examples and you should have no problems.

what example(s)…that was my original question?! Is there one that works or a tutorial? Just trying to store a few integer values, as entered by the user so that these values can be restored after power removal.

a good example comes with the MS SDK. i am not at a pc, so I can not tell you exactly where it is on your machine, but it is in your user data area.

Some additional information and an example is also at .NET Micro Framework - FAQ

And another easy reference is to click on the “Downloads & Tutorials” link above !! All the online documentation pointers can be found here, for both NETMF and GHI SDK specifics.

thanks…

may do the trick …I will give it a try…it is the only thing I’ve seen that claims to work & is given in the form of a program.
even so it has a few strange descriptions:

[quote]Is ewr.Target = obj; enough to store the data in memory?..Yes. No other (strong) reference does prevent storing the data to the persistent storage, in opposite to standard WeakReference.
[/quote] …what ??

[quote]As it was already said, you have to set ewr.Target before calling Recover. So if you don’t recover, you don’t have to just to keep the data to the next start.[/quote]…I guess that just means no worries

@ Hoyt,
I agree with you that after reading several posts on this forum I got the feeling that EWR is not reliable. That it sometimes does not survive a hard reboot. I admit that I didn’t try using EWR myself, so I can’t say for certain that there problems, but I didn’t want to spend the time figuring it out. That is one reason why I wrote the utility at this link:

http://code.tinyclr.com/project/444/ini-file-settings-utility/

If you notice I defined a generic ISettingsProvider interface for the utility. The idea is that in the future I could replace the IniSettings class with an EWRSettings class and my project would still work the same.

To my own experience i think ewr is reliable. I have it running in production without any problems so far, but i had problems in the beginning to get it working reliable because, to my opinion, of poor and incomplete documentation. There is actually one issue that i have to cover, I had problems erasing memory using MFDeploy after using EWR. I have a sense of feeling, but not sure, there is a relation. The lack of time stops me for testing it.

A important GHI method you should pay attention to which in not in the miloush example is FlushExtendedWeakReferences() You can find it in the GHI Util class.

@ JasDev… good approach to use an Interface!

I just noticed the EMX datasheet mentions there is 4K for “direct storage”, as …I searched around here but see no mention of it or how it is used (well, I’m not sure how you search in titles, or what word combos/wildcards, etc may be used)…

is this 4K bank just as good/easy to use/reliable?

“direct storage” == EWR or PersistentStorage

There is also 2KB battery backup memory available for emx. See BatteryRam class. Maybe this refers to the 4KB in the datasheet and probably 2KB is available to the user.

Maybe someone can confirm if this assumption is wrong or right.

This is taken right from the cobra datasheet:

[quote]Internal FLASH Storage

Using Extended Weak References. 128KB for user use and 128KB for system use.
Or using the 4KB direct storage[/quote]

Well, has anyone used this 4K storage? it sounds different than EWR.

I am not sure if those 4k are exposed to users. We use it internally.

You should use EWR