I'm successfully jump from bootloader to application and application to bootloader.
Please note I'm not using watchdog in my bootloader.
When I'm enable watchdog in application it successfully jumps to bootloader but it reset after watchdog timeout. when I'm disable (not initialize) watchdog then it works.
Application to bootloader jump Code:
while(xUART.u1TxOnGoing); // wait till UART send all bytes
void FirmwareUtility_Boot(U32 u32Address)
/* Ref: https://community.nxp.com/thread/494497 */
typedef void (*APPLICATION)(void);
// Clear all interrupts and disable before vector reallocate
/* Disable SysTick timer */
SysTick->CTRL &= ~(SysTick_CTRL_TICKINT_Msk | SysTick_CTRL_ENABLE_Msk);
// Vector reallocate
SCB->VTOR = (u32Address & SCB_VTOR_TBLOFF_Msk);
xEntryPoint = (APPLICATION) *((U32 *)(u32Address + 4));
I would need to read the manual for the LPC845, but for almost all other MCUs I came across, a watchdog cannot be disabled once it is enabled. This is by design.
> I'm successfully jump from bootloader to application and application to bootloader.
We use bootloaders for all our devices, on several architectures.
However, we do never "jump" from application to bootloader, but set a specific "stay in BL flag", and reset the device to get back into the BL. Often simply by a busy loop to run into the watchdog-reset.
The BL only executes the application if it is correct (checksum), and the "stay in BL" flag is not set.
You may set flag in your boot code to monitor where your code invoke watchdog.
But I suggest you disable watchdog before entering main code. some system initialization code. Normally we won't see any problem in a new created project.
But for example If the code includes large global array, RAM initialization in startup code takes time. If the program has many global variables to be initialized, technically it's hard to feed dog during the initialization process.
So it's right to watchdog before enter your application. enable it after the code gets into application.
Have a nice day,
That's what I have asked in my first post I'm disabling watchdog before jump but not able to disable it.
In user manual (Rev. 1.6 — 8 December 2017) page 416 I found it is written that "“Safe” watchdog operation. Once enabled, requires a hardware reset or a Watchdog reset to be disabled." check attached image.
Is it that once I enable watchdog then I can't disable it in same application without reset?
I seems got the same issue with LPC1830.
Once I open WWDG, I found it can not disable.
I found the register value is "LPC_WWDT->MOD = 3". But register is out of control. Even if I has disable wwdt interupt trigger.
NVIC_DisableIRQ(WWDT_IRQn); But still not working.
try to set watchdog WINDOW register as 0xFF FFFF in the beginning of your startup code. see if this can resolve the issue.