Embedded Artists


We are the leading providers of products and services around prototyping, evaluation and OEM platforms using NXP's ARM-based microcontrollers.

LPC4088DM Using Onboard Memories

The display modules have several onboard memories:

  • 32 MB external SDRAM (non-persistent)
  • 16 MB external QSPI Flash
  • 8 KB external configuration EEPROM
  • 4032 byte internal EEPROM

External SDRAM

The DMSupport library has support for the SDRAM. It is initialized in the init() function of DMBoard and it is not a configurable option.

The SDRAM is attached to the heap and allows malloc(), realloc() and free() functions to use it.

Troubleshooting!

The code that hands over the SDRAM to the heap is very toolchain dependant and if it causes you problem then comment out the two functions at the top of the sdram.cpp file in the DMSupport library.

External QSPI Flash

The display module has an SPI Flash Interface (SPIFI) allowing external serial flash memories to be connected with low performance penalties. A driver API included in on-chip ROM handles setup, programming and erasure and after initializing the SPIFI driver, the flash content is accessible as normal memory (in the 0x28000000..0x28ffffff memory range) using byte, halfword, and word accesses by the processor and/or DMA.Programming (i.e. writing data to the flash) is supported for up to 256 bytes at a time (which is the size of a "page" in the flash). Programming means that a bit can either be left at 0, or programmed from 1 to 0. Changing bits from 0 to 1 requires an erase operation. While bits can be individually programmed from 1 to 0, erasing bits from 0 to 1 must be done in larger chunks (manufacturer dependant but typically 4Kbyte to 64KByte at a time).

The 16 MB QSPI flash on the display modules can be used in three different ways (or a combination thereof): 1) To store program data/code for large programs. 2) To hold a file system 3) To store persistent data at runtime

To use the QSPI flash it must first be enabled in the dm_board_config.h file:

#define DM_BOARD_USE_QSPI

Program CODE/DATA

The linker scripts for the mbed online compiler as well as for Keil uVision automatically places read-only parts of the code in QSPI FLASH if the space in the internal flash is too small. As for normal compiling, the online compiler will generate one binary even if both internal flash and QSPI FLASH is used. The mbed HDK is responsible for writing the binary to the correct memory addresses so no special user action is needed when flashing.

The CODE/DATA will always spill over to the start of the flash.

Note

The QSPI flash is slower than the internal flash so try to keep RO-CODE in the internal flash and only put RO-DATA in QSPI flash.

QSPI File System

The DMSupport library has support for using the QSPI flash (or parts of it) as a file system. This is described in more detail here.

Note that the QSPI File System is always placed at the top/end of the flash so that it can coexist with any CODE/DATA placed by the linker scripts.

R/W Access at Runtime

The DMSupport library has a SPIFI class, allowing direct access to the QSPI flash at runtime:

Import library

Public Member Functions

SpifiError init ()
Initializes the SPIFI ROM driver making the content of the external serial flash available.
Device device ()
Returns the detected external serial flash.
uint32_t memorySize ()
Returns the size (in bytes) of the external serial flash.
uint32_t eraseBlockSize ()
Returns the size of an erase block (in bytes) on the external serial flash.
uint32_t getVerificationErrorAddr ()
Returns the address where the verifcation failed.
void internalData (SPIFIobj **initData, const SPIFI_RTNS **romPtr)
Used by the QSPIFileSystem class to get access to all spifi internal data.
SpifiError program (uint32_t dest, unsigned len, char *src, Options options, bool verify=false, char *scratch=NULL)
Copies len data from src to dest.
SpifiError erase (uint32_t dest, unsigned len, char *src, bool verify=false, char *scratch=NULL)
Erases the content of the memory at the specified address.

The flash is still initialized by the init() function in DMBoard but it is then possible to use the SPIFI class to modify the flash.

#include "SPIFI.h"
...
void main() {
  // call DMBoard::instance().init() and handle return code
  ...
  
  // Write "Hello World!" into the first bytes of the SPIFI
  char buff[20] = "Hello World!";
  err = SPIFI::instance().program(0, strlen(buff)+1, buff, SPIFI::EraseAsRequired);
  if (err != SPIFI::Ok) {
    printf("Failed to write to SPIFI, error %d\n", err);
  }

  // Now verify that it can be read
  if (memcmp((char*)SPIFI::SpifiMemBase, buff, strlen(buff)+1) == 0) {
    printf("Readback from memory OK: '%s'\n", SPIFI::SpifiMemBase);
  } else {
    printf("Spifi does not contain the correct data!\n");
  } 
}


Note

Make sure that the area written to is not used by the file system or contains CODE/DATA as it would likely crash the system.

External Configuration EEPROM

The configuration EEPROM on the display module is used to store initialization code (i.e. the BIOS) and is reserved by the system.

Overwriting the contents of this EEPROM (address 0xAC/0xAD) will cause the board to fail in the init() function of DMBoard. To prevent this the BiosEEPROM class in the DMSupport library only have a read function.

Internal EEPROM

The LPC4088 MCU has an onchip 4032 byte EEPROM that can be used to store data persistently.

The DMSupport library has an InternalEEPROM class for direct access to it:

Import library

Public Member Functions

void init ()
Initializes the EEPROM.
uint32_t memorySize ()
Returns the size (in bytes) of the internal EEPROM.

Information

Apart from direct access to the EEPROM, the DMSupport library comes with a wrapper class that uses the EEPROM to store key-value pairs: Registry. Read more about it here.


All wikipages