AnsweredAssumed Answered

LPC18xx / LPC43xx SPIFI Flash Drivers (v7.6.0 to v 7.8.0)

Question asked by LPCware Support on Mar 31, 2016

This FAQ documents the SPIFI flash driver support provided in LPCXpresso IDE v7.6 to v7.8 inclusive. If you are using an earlier version of LPCXpresso IDE, then please refer to the FAQ "LPC18xx / LPC43xx External Flash Drivers " instead. If you are using LPCXpresso IDE v7.9.0 or later, then please refer to the FAQ "LPC18xx / LPC43xx SPIFI Flash Drivers ".




The NXP LPC1800 and LPC4300 series of MCUs provide a mechanism to allow the connection of external SPIFI flash devices, which can be used for both data storage and also for code - with support for XIP (execute in place). For LPC18x0 and LPC43x0 parts (such as LPC1830 and LPC4370) there is actually no built in flash internal to the MCU, and thus SPIFI devices are typically used for the primary storage. For other "non-zero-ending" parts, such as LPC1857 and LPC4322, these parts have internal flash, but external SPIFI devices can still be used (for example for storing graphics data).


In order to allow the use of SPIFI flash devices, LPCXpresso IDE provides mechanisms to configure the memory layout of a project to include this external flash, and then configure the debugger to use a suitable SPIFI flash driver to program the generated image down into the external flash. This configuration is carried out using the "Memory Configuration Editor".


Note: SPIFI flash is located at 0x14000000 in the LPC1800/4300 memory map.


Supplied SPIFI flash drivers


LPCXpresso IDE ships with a number of prebuilt SPIFI flash drivers based on the new generation LPC SPIFI Peripheral|NXP . lpcspifilib has a number of advantages over the previous generation SPIFI library used by older LPCXpresso releases - in particular it supports programming newer flash devices, as well as being available in source form as well as in pre-built library form.


As of LPCXpresso 7.6, the following drivers are provided:


Flash driverFlash sizeSector sizeSupported PartsExample board fitted with a supported part
LPC18_43_SPIFI_64MB_256KB.cfx64MB (512Mb)256KBSpansion S25FL512S
LPC18_43_SPIFI_32MB_256KB.cfx32MB (256Mb)256KBSpansion S25FL256S 256k sector
LPC18_43_SPIFI_32MB_64KB.cfx32MB (256Mb)64KBSpansion S25FL256S 64k sector
LPC18_43_SPIFI_16MB_256KB.cfx16MB (128Mb)256KBSpansion S25FL129P 256k Sector {S25FL128S}Hitex LPC1850 and LPC4350 (rev A5)
LPC18_43_SPIFI_16MB_64KB.cfx16MB (128Mb)64KBSpansion S25FL129P 64k Sector
LPC18_43_SPIFI_8MB_64KB.cfx8MB (64Mb)64KBSpansion S25FL064P
Spansion S25FL164K
Macronix MX25L6435E
Winbond W25Q64FV
Hitex LPC1850 and LPC4350 (rev A4)
LPC18_43_SPIFI_4MB_64KB.cfx4MB (32Mb)64KBSpansion S25FL032
Macronix MX25L3235E
Winbond W25Q32FV
NGX LPC4330-Xplorer and LPC1830-Xplorer
Keil MCB4357 and MCB1857
LPC18_43_SPIFI_2MB_64KB.cfx2MB (16Mb)64KB

Spansion S25FL016K {W25Q16DV}
Macronix MX25L1635E

LPC18_43_SPIFI_1MB_64KB.cfx1MB (8Mb)64KBMacronix MX25L8035E
Winbond W25Q80BV
LPCXpresso4337 / LPCXpresso43S37 / LPCXpresso18S37

Note : Supported parts denoted in { } in the above table are 'clones' of the part they appear next to (they have the same ID)


Alias flash drivers


For compatibility with projects created with earlier LPCXpresso IDE releases, a number of other flash driver files are supplied which are just renamed versions of the standard drivers above. The use of these 'alias' drivers in not recommend, as they may not be shipped with future LPCXpresso IDE releases.


The following is a list of alias flash drivers, with the recommended replacement driver listed in each case.


  • LPC18_43_S25FL129P_256K.cfx -> LPC18_43_SPIFI_16MB_256KB.cfx
  • LPC18_43_S25FL129P_64K.cfx -> LPC18_43_SPIFI_16MB_64KB.cfx
  • LPC18_43_S25FL164K.cfx -> LPC18_43_SPIFI_8MB_64KB.cfx
  • LPC18_43_S25FL032P.cfx -> LPC18_43_SPIFI_4MB_64KB.cfx
  • LPC18_43_MX25L3235E.cfx -> LPC18_43_SPIFI_4MB_64KB.cfx
  • LPC18_43_W25Q32FV.cfx -> LPC18_43_SPIFI_4MB_64KB.cfx
  • LPC18_43_W25Q80BV.cfx -> LPC18_43_SPIFI_1MB_64KB.cfx
  • LPC18_43_SPIFI_1MB_4KB.cfx -> LPC18_43_SPIFI_1MB_64KB.cfx


Note: that the aliased driver - LPC18_43_SPIFI_1MB_4KB.cfx - is provided specifically to allow some existing projects using the LPC-Link2 as an LPC4370 evaluation board to continue working. It is not a true 4KB sector driver, it is just that the original LPCXpresso SPIFI flash driver mechanism treated the W25Q80BV device as a 4KB sector device (whereas the current mechanism uses it as a 64KB sector device).


Flash driver compatibility


The API used by flash drivers in LPCXpresso 7.6 and later was rewritten compared to earlier releases, in order to provide enhanced flash programming speeds.


This means that flash drivers provided with LPCXpresso IDE v7.6 and later are not compatible with earlier releases of LPCXpresso IDE. Flash drivers provided with earier releases of LPCXpresso IDE (or written by users to work with earlier releases) should still function with LPCXpresso IDE v7.6 and later, but will not provide the enhanced flash programming speeds that LPCXpresso IDE v7.6 and later support.

Thus if you have your own SPIFI flash driver written for use with an earlier LPCXpresso release, you may wish to consider porting it into the latest SPIFI flash driver projects (as detailed below).


Adding support for other SPIFI devices


It is planned to provide prebuilt support for further SPIFI flash devices in LPCXpresso IDE, as support for further devices is added to the underlying LPCOpen lpcspifilib.


However the actual projects used for building the supplied SPIFI flash drivers can be found in the LPCXpresso IDE examples subdirectory - so that you can modify these yourself in order to produce drivers for other SPIFI flash devices.


You can import these into LPCXpresso from:



For details of how to add support for new flash devices to lpcspifilib, please consult its documentation.


Once you have created a new or modified SPIFI flash driver, then you will need to place it into the below directory in order for LPCXpresso IDE to find it: