LPC series - EMC buffer
The LPC device series (e.g. LPC1788, LPC4350, ...) come with an external memory controller (EMC) which can be used to interface external flashes as for example parallel CFI NOR flash. In order to improve the performance, the EMC controller comes with a 4 x 16 word read / write buffer. However, enabling the buffer may also create problems during flash programming as data may be cached instead of programmed to the hardware. Besides the initial flash download, this especially creates issues when using the unlimited number of breakpoints in flash feature of the J-Link DLL. Therefore, in order to use the flash programming logic of the J-Link DLL + EMC buffer mode enabled, some special handling needs to be performed before and after flash download to make sure that all data make it into the hardware and are not buffered in the EMC buffer. For detailed information about which steps are required to make sure that flash programming through the J-Link DLL is working as expected with buffer mode enabled, please refer to the examples below.
Please make sure to use at least V6.11e of the J-Link software.
The IAR project contains two counter loops, one located in the internal flash and one located in the external CFI flash. The external CFI flash is interfaced through the EMC with buffer mode enabled. The project uses a J-Link script file which includes the buffer handling:
The J-Link script file below is also used in the IAR example project. However below it can be downloaded separately as it can be used within any other IDE or application based on the J-Link DLL: