Microcontroller Solutions TechZone Magazine, April 2011 - Digikey
Microcontroller Solutions TechZone Magazine, April 2011 - Digikey
Microcontroller Solutions TechZone Magazine, April 2011 - Digikey
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Physical interface<br />
Figure 3 shows the physical interface of the SPIFI peripheral. It uses the<br />
standard four pins for traditional SPI devices; when configured with Quad<br />
SPI memory it uses an additional two pins to support the quad capability.<br />
Figure 3: Physical interface of the SPIFI peripheral.<br />
Different serial flash vendors and devices accept or require<br />
different commands and command formats. The SPIFI peripheral provides<br />
sufficient flexibility to be compatible with most common SPI flash and<br />
includes extensions to help insure compatibility with future devices.<br />
Reduced register set<br />
A compact register set gives the SPIFI peripheral a considerable amount<br />
of intelligence while keeping it simple to use. It takes just eight registers<br />
to control the SPIFI function, interface with the external SPI memory,<br />
store and retrieve data, and monitor operation. Since the built-in ROM<br />
API governs setup, programming, and erasure, handling the external SPI<br />
memory in an application is a matter of a few calls. As a result, the SPIFI<br />
peripheral is simple to configure and easy to support in the application.<br />
Software commands<br />
The external memory responds to commands sent by the<br />
microcontroller software and to commands automatically sent by the<br />
SPIFI peripheral when its software reads the serial fl ash region of<br />
the memory map. Commands are divided into fi elds called opcode,<br />
address, intermediate, and data. The address, intermediate, and<br />
data fi elds are optional depending on the opcode. Some memory<br />
devices include a mode in which the opcode can be implied in Read<br />
commands for higher performance. Data fi elds are further divided into<br />
input and output data fi elds depending on the opcode. All commands<br />
to the external SPI memory can be handled by calls to the ROM API.<br />
The SPIFI ROM API driver lets the contents of the external SPI memory<br />
be accessed using simple load commands, so the application code<br />
remains compact and easy to write.<br />
CPU-independent operation<br />
The SPIFI software can read data from the external memory and write it<br />
to RAM or a peripheral without involving the CPU. With microcontrollers<br />
that have an integrated LCD controller, for example, this feature can be<br />
used to enhance performance and save power. Images can be stored in<br />
the external memory and fetched by the LCD controller. Since the LCD<br />
controller reads most of its data from sequential addresses, the SPIFI<br />
peripheral can pre-fetch the addresses so they’re ready when needed,<br />
with essentially no wait states. The entire operation can happen without<br />
getting the CPU involved, and there’s no need to load the images into<br />
on-chip RAM before the LCD controller fetches them. That means the<br />
system can use a microcontroller with less on-chip RAM, or can free<br />
up its existing RAM for other tasks. Also, since the images are fetched<br />
directly by the LCD controller, the LCD display can refresh graphics<br />
faster, so simple operations like opening and closing windows appear<br />
smoother. Also, to save power, the system can use a slower clock speed<br />
without having a noticeable impact on the display’s performance.<br />
Direct execution<br />
From a software point of view, the microcontroller can execute code<br />
directly from the external SPI memory. Direct execution can be helpful<br />
when using in-fi eld upgrades or when replacing functions originally<br />
shipped in on-chip fl ash. Validated upgrade code can be placed in the<br />
external fl ash. If, for example, the system’s function addresses are in<br />
a table stored in on-chip fl ash, the table can be reprogrammed with<br />
the address of the routine now housed in external fl ash. Alternatively,<br />
if the page containing the start of the original routine is stored in<br />
on-chip fl ash, the page can be updated with a branch long jump to<br />
the new routine in external fl ash. In either case, the new code doesn’t<br />
need to be loaded into the on-chip RAM to execute, because the SPIFI<br />
peripheral allows direct execution from the external memory.<br />
Executing code from an external memory is never as fast as using<br />
on-chip memory. The SPIFI peripheral isn’t intended for use with<br />
real-time functions that require peak performance but, for less critical<br />
code sequences, SPIFI can be a very attractive option.<br />
Write-while-execute functions<br />
The SPIFI supports write-while-execute functionality, which means it<br />
can program or erase the external memory simply and quickly, even<br />
when the processor is executing code from on-chip fl ash. Since the<br />
SPIFI peripheral can run on its own, without interaction from the CPU,<br />
the system can perform its functions without interruption while the<br />
serial fl ash is being reprogrammed.<br />
This feature can be used to perform software upgrades in the fi eld,<br />
because the system can write to the external memory without<br />
interrupting critical application code. In a smart meter, for example,<br />
the metering function needs to operate continuously, even during a<br />
software upgrade. With SPIFI, the utility company can confi gure the<br />
system to write any new code to external fl ash, without interrupting<br />
the active metering function, and can then integrate the new code<br />
into the system. Similarly, in a system that has a USB port, new code<br />
can be placed on a portable USB drive and transferred to the external<br />
fl ash without interrupting critical operations.<br />
Conclusions<br />
NXP’s new SPI Flash Interface (SPIFI), a patent-pending feature initially<br />
available on its new ARM-based LPC1800 Cortex-M3 microcontrollers,<br />
lets external serial fl ash memory appear in the microcontroller’s<br />
memory map, so it can be read like on-chip memory. This gives<br />
designers access to a large amount of external fl ash memory while<br />
reducing system costs and minimizing the design footprint.<br />
The SPIFI peripheral creates a way for designers to use a small,<br />
inexpensive serial flash where they might previously have needed to use<br />
a larger, more expensive parallel flash to meet the system’s performance<br />
requirements. Designers can take advantage of the many benefits of<br />
serial flash — low-cost, small size, simple configuration — without<br />
making large sacrifices in performance. SPIFI also lets designers opt for<br />
a microcontroller without a parallel interface, for a smaller, less expensive<br />
design that still delivers the required performance.<br />
The NXP roadmap for SPIFI includes migration to other Cortex-M<br />
families, including the low-cost Cortex-M0 series and the upcoming<br />
Cortex-M4 series of Digital Signal Controllers.<br />
www.digikey.ca/microcontroller<br />
21