MicroController: LPC845
Subject: Resetting peripherals and Core to jump from BootLoader to Application
When jumping from BootLoader to Application I'd like to get rid of all history
(e.g. clock settings, inits of peripherals, pending interrupts) by
1. setting VTOR to 0x2000, as follows:
*((volatile uint32_t*) 0xE000ED08) = 0x00002000;
2. resetting all peripherals and the Cortex-M0+ Core
With the sequence
*((volatile uint32_t*) 0xE000ED08) = 0x00002000;
NVIC_SystemReset();
in combination with calling function SYS_ResetAllPeripherals (see below),
immediately after reset, this goal is not achieved
(and it's hard to debug this low level stuff, going through reset).
I would appreciate any advise on this matter.
// -----------------------------------------------------------------------------
// Function : SYS_ResetAllPeripherals()
// Comment : Reset all peripherals (which can be reset by
// means of PRESETCTRL0 and PRESETCTRL1)
// except the Flash Controller
// Params :
// Input : -
// Output : -
// Return : -
// -----------------------------------------------------------------------------
void SYS_ResetAllPeripherals(void)
{
// Activate reset of all peripherals
LPC_SYSCON->PRESETCTRL0 = 0x0402001F;
LPC_SYSCON->PRESETCTRL1 = 0xFFFFFFE4;
// Deactivate peripheral reset
LPC_SYSCON->PRESETCTRL0 = 0xFFFFFFFF;
LPC_SYSCON->PRESETCTRL1 = 0xFFFFFFFF;
}