Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

LPC2000 MCU memory acceleration module

We know that ARM MCU core can run at speed line 60Mhz or even more than 100Mhz. But usually ARM program is located in Flash memory. But flash memory execution speed can reach only up to20MHz. Practically speaking Flash memory is 3 – 4 times slower than ARM core speed can run. Of course one of workarounds could be loading critical program parts to RAM, but RAM is limited resource – we cannot locate all program to RAM as it is needed for data storing and so on. So second option is to have on chip cash memory, which stands between CPU and memory. Well LPC2000 and other ARM7 families have reduced cache module so called Memory acceleration module (MAM).


Without going too deep on how MAM works, I ca say that basically acceleration works by loading four ARM instruction at same time from Flash (Eight THUMB instructions). If ARM is running at speed of 60MHz then there would be 3 access cycles to flash needed. MAM loads these instructions at one cycle. Usually MAM module is disabled after MCU reset. There can be three working modes of memory Acceleration Module:

  • MAM is OFF- all instructions are read directly from Flash memory;

  • Partially enables MAM – sequential instructions are accessed using MAM while branches and constants are accessed directly from Flash;

  • Fully enables MAM – all memory fetching from MAM.

MAM is controlled by two registers – timing(MAMTIM) and control(MAMCR). There also are statistics registers that allow gather statistical information about instruction and data hit rate.

To initialize MAM you only need two lines of code:

//switch OFF MAM before adjusting timing
// MAM-Fetch cycle to 3 cclk (>40MHz)
MAMTIM = 3; 
// Activate MAM 
MAMCR = 2; 

So if cclk<=20 Mhz then MAMTIM=1

if cclk 20-40 Mhz then MAMTIM=2

if cclk 40-60 Mhz then MAMTIM=3

if cclk 60-80 Mhz then MAMTIM=4

MAMTIM=4 for >80Mhz.

MAMCR=1 – partially enables MAM module.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.