LPC11 - interrupts during IAP

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by push2eject on Tue Jul 28 18:42:39 MST 2015
A heads up: It seems interrupts must be disabled for all IAP calls, not just erase/write calls.

From the LPC11C14 user manual (my highlight):

20.4.7 Interrupts during IAP
The on-chip flash memory is not accessible during erase/write operations. When the user
application code starts executing the interrupt vectors from the user flash area are active.
The user should either disable interrupts, or ensure that user interrupt vectors are active in
RAM and that the interrupt handlers reside in RAM, before making a [color=#f00]flash erase/write IAP
call.[/color] The IAP code does not use or disable interrupts.

I took this to mean I only had to disable interrupts when performing an erase or write comman. However, I found that the PC was occasionally jumping to 0xfffffffe unless I also disabled interrupts during "Prepare Sectors For Write Operation" and "Compare" IAP calls as well. Took some while to figure this out, as it was a very intermittent fault.