blacksphere/blackmagic — pull request #57 by aibara (2014-09-16 21:55:30+00:00)
Title: LPC43XX: Attempt to handle case of running WDT.

We noticed problems with flashing the LPC43XX when using applications which enable the watchdog timer on the target. Since the flash processes runs IAP ROM code on the target, there is a risk that it will reset, while this ROM code is running. The timer is stopped while the target is suspended, but we resume the target in order to write to flash via the ROM code. If it happens to expire, it resets the target, causing the flash to fail, and confusing the debug probe. Unfortunately there does not seem to be a way to disable the watchdog timer once it has been enabled, so we settle for detecting if it is enabled, setting a long period and petting it before each IAP call.

This fixes observed failures burning flash on devices which are running with the watchdog timer enabled.