LPC18xx / LPC43xx SPIFI Flash Drivers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC18xx / LPC43xx SPIFI Flash Drivers

6,098 Views
lpcware-support
Senior Contributor I

This FAQ documents the SPIFI flash driver support provided in LPCXpresso IDE v7.9 and later. If you are using an earlier version of LPCXpresso IDE, then please instead refer to the FAQs:

Introduction

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". For more details, please see chapter 6 "Memory Editor and User Loadable Flash Driver mechanism" in the LPCXpresso User Guide.

Note: SPIFI flash is located at 0x14000000 in the LPC18xx/43xx memory map

Generic SPIFI Flash Driver

Earlier versions of LPCXpresso IDE provided a number of different SPIFI flash drivers (targeted at one or more specific SPIFI devices). This meant that it was the user's responsibility to select the correct SPIFI flash driver to match the device fitted to their target hardware.

LPCXpresso IDE v7.9.0 introduces an improved flash driver mechanism for SPIFI flash. Now a project targeting SPIFI flash only has to specify a single Generic flash driver : "LPC18_43_SPIFI_GENERIC.cfx". When a flash programming operation is performed, this driver will first interrogate the SPIFI device and determine its type, size and configuration which are then reported back to the host debug driver. Using this information the correct optimised programming routines for the SPIFI device detected can then be used.

When a debug session is started, the details of the SPIFI device detected will be displayed within the debug log information as below:

loaded v.2 External Flash Device on SPI 
C:\nxp\LPCXpresso_7.9.0_455\lpcxpresso\bin\Flash\LPC18_43_SPIFI_GENERIC.cfx
image 'LPC18/43 Generic SPIFI Jun 11 2015 15:01:32'
flash variant 'MX25L8035E' detected (1MB = 16*64K at 0x14000000)

The new Generic flash driver is built using LPCOpen lpcspifilib and will program all devices previously supported by LPCXpresso's individual SPIFI flash drivers. Support for new SPIFI devices will be added to the generic driver in future release.

Please note: Although the flash driver now reports the size and location of the SPIFI, the IDE's view of the world is determined just as before by the project memory configuration settings. It remains the users responsibility to ensure these setting match.

You can use the Generic SPIFI driver to interrogate an unknown SPIFI device. Simply create a project specifying the appropriate MCU and target the SPIFI address at 0x14000000, then when a programming operation or mass erase is performed and assuming the device is recognised its details will be reported. If required, the project memory configuration can then be edited to match the device size.

Compatibility

The SPIFI flash drivers provided with LPCXpresso v7.8.0 are still provided in LPCXpresso IDE v7.9.0, allowing existing projects to still be debugged without modification. However we would generally recommend that you modify your projects to use the Generic SPIFI flash driver instead, as the older drivers will be removed from future LPCXpresso releases.

Note however that the Generic SPIFI flash driver is not compatible with earlier versions of LPCXpresso IDE.

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 Generic SPIFI flash driver can be found in the LPCXpresso IDE examples subdirectory - so that you can modify these yourself in order to produce a driver which supports other SPIFI flash devices.

You can import these into LPCXpresso from:

install_dir\lpcxpresso\Examples\FlashDrivers\NXP\LPC18xx_43xx\LPC18_43_lpcspifilib_driver.zip

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:

install_dir\lpcxpresso\bin\Flash

Labels (1)
0 Kudos
0 Replies