2009-07-20 03:38 AM
Call a function before reseting by NRST
2011-05-17 04:18 AM
Hello,
is it possible to call a function before the NRST-Pin resets the hole system (e.g. to save some data in an external eeprom)? Is there any IRQ-Handler which could be called when pressing the switch connected to my NRST-Pin? Thank you :D2011-05-17 04:18 AM
Hi dmatheis;
You can use EXTI interrupt instead of NRST-Pin to reset the microcontroller. How? So you can connect a button in any EXTI. In the EXTI handler you can save your data and after that call NVIC_GenerateSystemReset() (software reset). B.R. M3allem2011-05-17 04:18 AM
Hi M3allem,
thanks for your replay, but I'm searching for a solution to get the beheavior/functionality of the EXTI also on the NRST pin. :-]2011-05-17 04:18 AM
A reset is a hardware condition that can't be trapped like a normal exception.
That said you can determine the cause of a reset *after* it has happened. See the ST Library function RCC_GetFlagStatus(). I do this in a current project to display/log the last reset cause along with additional information. Makes a great firmware/hardware debugging feature :) Edit: You can (and I do) get indication of a power failure and do stuff *before* you reset.[ This message was edited by: swhite on 20-07-2009 16:09 ]