Hi
I am planning to use the software-reset in arduino using the following function:
void(* resetFunc) (void) = 0;
and I am wondering whether it will reset the RAM contents. In other-words I am wondering about how it works? will it just redirect the prog's execution to the beginning or what.
If I want to restart the registers in software, what is the way to do so?
Mike433:
Can you elaborate on "you doubt even a hardreset will clear the RAM", as far as I know, a hardware reset should reset the contents of the RAM.
Thx.
Mike
I'm on my phone, and I haven't got a processor datasheet to hand - can you post the reference that leads you to this conclusion?
The application (sketch) will run from the beginning, but the registers will not be reset. Why do you want to clear the SRAM? The SRAM pointers of stack and heap will be reset when the application starts.
If you want to do a hardware reset from the sketch, use watchdog reset.
RAM is virtually never cleared to all 00s by any hardware action. Clearing RAM, whether SRAM, or any form of DRAM, requires software going through and writing zeroes to every location.
AWOL:
I'm on my phone, and I haven't got a processor datasheet to hand - can you post the reference that leads you to this conclusion?
You are right, my-bad
I double checked and the SRAM contents are lost usually during a power-reset and even with that the subject is tricky since the SRAM contains capacitors which take time to discharge and that can be any time from minutes to seconds.
RayLivingston:
RAM is virtually never cleared to all 00s by any hardware action. Clearing RAM, whether SRAM, or any form of DRAM, requires software going through and writing zeroes to every location.