Is it possible to save a variable in RAM and then make a watch dog reset and
then read back the same value from the RAM?
Or does the RAM get cleared?
I need to save a state machine state before the reset and then restore the
state after power up.
I'm coding in C.
Reply by Vladimir Vassilevsky●May 7, 20072007-05-07
Bubbah wrote:
> Is it possible to save a variable in RAM and then make a watch dog reset and
> then read back the same value from the RAM?
> Or does the RAM get cleared?
1. I haven't seen any information about the persistence of the data in
the internal RAM trough the hardware or watchdog reset. I wouldn't rely
on that.
2. The C startup clears RAM unless you declare your data in the
appropriate NO_INIT section.
3. The sophisticated algorithm will be required to distinguish the valid
data from the arbitrary garbage at the initial start.
> I need to save a state machine state before the reset and then restore the
> state after power up.
You don't want to do that.
Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com
Reply by dalai lamah●May 7, 20072007-05-07
Un bel giorno Bubbah digit�:
> Is it possible to save a variable in RAM and then make a watch dog reset and
> then read back the same value from the RAM?
I'm almost sure of that (only some registers in the register file are
set/reset by soft/hard reset), but the best way to know is to try. Remember
not to put your variables in an initialized section or obviously the loader
will set them automatically when the program restarts. For example you can
use an uninitialized global variable.
--
emboliaschizoide.splinder.com
Reply by Bubbah●May 8, 20072007-05-08
I'm going to try it out. I will save a 16 byte value to get better
certainty. If I only save an 8 bit value it is harder to know if it is my
value or some garbage (as Vladimir pointed out).
"dalai lamah" <antonio12358@hotmail.com> wrote in message
news:ofjn6o7cssnt.1pfuwhrmqoamp.dlg@40tude.net...
> Un bel giorno Bubbah digit�:
>
>> Is it possible to save a variable in RAM and then make a watch dog reset
>> and
>> then read back the same value from the RAM?
>
> I'm almost sure of that (only some registers in the register file are
> set/reset by soft/hard reset), but the best way to know is to try.
> Remember
> not to put your variables in an initialized section or obviously the
> loader
> will set them automatically when the program restarts. For example you can
> use an uninitialized global variable.
>
> --
> emboliaschizoide.splinder.com
Reply by TheDoc●May 8, 20072007-05-08
"Bubbah" <bubbah@is.com> wrote in message
news:463f16fe$0$90274$14726298@news.sunsite.dk...
> Is it possible to save a variable in RAM and then make a watch dog reset
> and then read back the same value from the RAM?
>
>
>
> Or does the RAM get cleared?
>
>
>
>
> I need to save a state machine state before the reset and then restore the
> state after power up.
>
>
>
> I'm coding in C.
>
>
>
registers are reset but ram is undefined..
it's nasty, but you can place data in an uninitialized section..
declare your "object data" as a structure for ease and run a CRC on the data
block
for integrity.... i would suggest a better method using an extant non
volatile memory device tho..
Reply by Vladimir Vassilevsky●May 8, 20072007-05-08
Bubbah wrote:
> I'm going to try it out. I will save a 16 byte value to get better
> certainty. If I only save an 8 bit value it is harder to know if it is my
> value or some garbage (as Vladimir pointed out).
>
Saving persistent data to internal RAM is a bad idea.
There is absolutely no guarantee that it will work. And even if it works
for now, it may stop working with the next CPU revision.
There is a zillion of possible reasons for the internal RAM to be
completely or partially corrupt at reset, and you don't have any control
about it. Thus if it is not explicitly guaranteed that RAM survives
through the reset, you shouldn't rely on that.
Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com
Signal Processing Engineer Seeking a DSP Engineer to tackle complex technical challenges. Requires expertise in DSP algorithms, EW, anti-jam, and datalink vulnerability. Qualifications: Bachelor's degree, Secret Clearance, and proficiency in waveform modulation, LPD waveforms, signal detection, MATLAB, algorithm development, RF, data links, and EW systems. The position is on-site in Huntsville, AL and can support candidates at 3+ or 10+ years of experience.