Content originally posted in LPCWare by samc77 on Mon Jul 21 23:23:44 MST 2014
Hi,
thanks for your quick answer.
for the intentional reboot, we are doing it very similiar to your version. (I think there is a typo, should be 0x40053100 for both lines, right?)
Doing it exactly your way didnt work for some reason, but replacing the Core Reset by a WDT reset works.
Surely, its not enough to reset the GPIO and ETHERNET, instead its GPIO, SCU and not sure if needed: EMC. (If the SCU is not reset, the pin FUNC will stay at EMC and it will keep in control over the pins)
So our code is this:
// reset the SCU, EMC, GPIO
// this is required to make sure that the pins A6 and A9 are hi level during reset.
// if they are not, the system will not boot from SPIFI and instead end up in the ISP mode
LPC_RGU->RESET_CTRL0 = (1<<9) | (1<<21) | (1<<28);
wdt_reset();
__disable_irq();
__disable_fault_irq();
st_Wdt_Config w;
w.wdtReset = 1;
w.wdtProtect = 0;
w.wdtWarningVal = 0;
w.wdtTmrConst = 10000;
WWDT_Init();
WWDT_Configure(w);
WWDT_Start();
while(1);
That works reliably.
BUT: if a watchdog timeout occurs, normally, the reset is triggered directly. That will cause the chip to enter the ISP most of the time.
Now, we catch the WDT IRQ and disabled the WDT RESET. That works again.
But will not work in case IRQs are disabled, and that happens to be at some parts of the code.
So its not a real solution, just a 90% workaround.
So my question still is: is it possible to force the chip into the "normal" operation mode, not debug, where it really resets completely on WDT reset?
Thanks,
Simon