Previous Page   Next Page

 

Embedded data storage: simple technology, a complex decision




Think Future First
READ THIS TO FIND OUT ABOUT:
  • Embedded-memory optimisation
  • Flash EEPROM emulation
  • Designing with Flash, MRAM, SRAM and FRAM


It is a common challenge for an embedded designer to find the right means to store data safely and reliably in a microcontroller-based system. Loris Destefani, Field Applications Engineer, Future Electronics (Italy) explains.

Typical microcontroller applications that require embedded memory include controlling LCDs fed by tables of data, saving programmablesystem configuration settings, and logging data. These are commonly required in industrial, medical, gaming and vending equipment designs.

In many cases, it is also necessary for this data to be retained when the device is powered down or in the event of sudden power failure.

A variety of well-known memory technologies can carry out data-storage functions, and are not especially complicated or difficult to use. So how much attention does the specification of an embedded memory actually warrant?

The surprising answer is: quite a lot. Implementing a data-storage function is simple; the challenge is – as usual in the embedded world – implementing it at the lowest total cost and with the smallest possible footprint. The presence of the microcontroller complicates the decision. Other factors that affect total cost of ownership include design time, manufacturing processes, board-design flexibility, and even upgradeability. The type of memory designed-in at the beginning of the product lifecycle could have an impact on the cost of future product evolutions.

While basic memory technology has changed relatively little in the past decade, microcontrollers and their on-chip memories have undergone extensive product development. The latest generations of microcontrollers give today’s embedded designers a very different set of memory choices than were available only five years ago.

Nevertheless, some basic technical questions are always going to put certain limits on the options available to the designer. The key issues are:

  • Number of bytes of data to be saved, and the time in which this data should be written
  • The total number of read, write and erase cycles
  • The overall time to market

Remembering the challenge of implementing data storage at the lowest total cost, it makes sense to consider how to make best use of the MCU’s on-board Electrically Erasable Programmable Read-Only Memory (EEPROM). Utilising this resource has the least impact on the overall bill of materials.

The major limitation on the use of an on-board EEPROM can be found in Figure 1: for most applications, EEPROM is too slow, supports too few read/write cycles and provides too little capacity.

Capacity is a particular problem as it can be costly if a product designed around on-chip EEPROM undergoes a revision or upgrade that demands more memory capacity. The obvious solution is to drop in a replacement MCU with a bigger EEPROM, but this will have serious cost implications. Typically, such devices also have additional features or higher performance that significantly increase the unit price.

For this reason, on-chip EEPROM is rarely the optimal non-volatile memory choice for embedded designs. Much more commonly an EEPROM emulation solution implemented in an on-chip Flash memory will be more suitable.

Because of the superior density of Flash, memory capacity is less likely to be a problem. And by using the MCU’s Flash in EEPROM-emulation mode, the designer can still benefit from useful EEPROM features; principally the ability to manipulate data at the level of single bytes and bits.

 


Fig. 1: strengths and weaknesses of non-volatile memory technologies

 

Other advantages of Flash in EEPROM-emulation mode over ordinary EEPROM include:

  • It is possible for Flash to sustain over 100,000 erase cycles.
  • Flash retains data for longer than EEPROM
  • Write time in Flash is shorter, which is especially important if mission-critical data needs to be saved in the event of a power failure.

EEPROM emulation is not a difficult technique and has four basic stages:

  1. Allocate a section of the embedded Flash for EEPROM emulation
  2. Create the specific Erase/Read/Write routines
  3. Copy the appropriate routine from Flash memory to RAM (In some devices, Erase and Write routines can only be executed from RAM)
  4. Execute the routine.

There is one issue to bear in mind in such an implementation: erasing a whole block of Flash when overwriting data in any given location has to be avoided. This can be solved by dividing each block into several pages and dedicating a few bytes of each page to store the location of bytes in each page that are already programmed.

Depending on budget and application requirements, there are many types of on-board Flash available on the market. For instance, MCUs come with either single- or dual-voltage Flash. In the dual-voltage variant, reprogramming requires a different voltage from the standard operating voltage. The dual-voltage variants are cheaper, but they require either an external programming tool, or external components and a software routine running an external boost converter for in-system reprogramming.

Flash MCUs in Freescale Semiconductor’s product range start at the very low end of the price scale with 1kB dual-voltage Flash in a 6-pin package and an operating voltage between 1.8V to 5.5V. Further up the range, Freescale offers 4kB or 8kB of single-voltage Flash in 8- or 16-pin packages, the ability to write/erase at a 1.8V (suitable for battery-powered applications), and ratings for 100,000 write/erase cycles. An interesting product innovation in Flash MCUs has recently been introduced by Freescale in its MC9S08LC series, which features a 40x4 LCD peripheral on board.

In the MC9SO8LC series, the internal Flash is divided into two arrays (see Figure 2). This architecture is particularly appropriate for users implementing EEPROM emulation. The emulation routine normally occupies the whole memory, so that it cannot be accessed for as long as the system is reading or writing data. With Freescale’s dual-array architecture, the system can now execute any kind of access to one array (read, write or erase) and simultaneously provide applications with access to data in the other.

 

What if on-board Flash is unsuitable?

EEPROM emulation implemented in on-board Flash, then, is an attractive embedded memory solution: low-cost, small and easy to programme using tools provided by MCU suppliers.

But it has limitations that invalidate its use in certain types of applications. For many hard real-time control applications the processing time required to execute the EEPROM emulation routine is too long. Other applications, particularly data-logging and metering, require a large storage capacity that even the biggest on-board MCU memories cannot offer.

 


Fig. 2: internal structure of Freescale’s MC9SO8LC60 8-bit microcontroller

 

In addition, there are difficult design challenges involved in the use of the same single Flash memory for multiple tasks. These may include, for example, emulated EEPROM for data that can be changed, emulated EEPROM storing of read-only configuration parameters, and application software that can be remotely updated. It should be seriously considered whether different tasks should be assigned to different memories, even at the expense of BOM and board space.

The options available to the designer here include external EEPROM, serial Flash, non-volatile SRAM, Magnetic RAM (MRAM) and Ferro-electric RAM (FRAM).

External EEPROM is a useful choice where the application requires strong write protection. EEPROM devices come equipped with both hardware and software protection features that allow the designer to design the appropriate level of security into the product. EEPROM devices with a wide choice of security mechanisms are available from STMicroelectronics.

External Flash, on the other hand, is attractive because it offers the lowest cost per kilobyte of storage. Indeed, in data-logging applications and others in which the on-board Flash is insufficient, it is generally sensible to address the need for additional storage with the smallest possible external Flash IC. This can often be the right choice even when an alternative MCU is available that offers sufficient on-board Flash, as the new MCU will require a new board layout and recompiling of code, and will attract a significantly higher price per unit than the original MCU.

Moreover, the market is now making available serial Flash devices that offer EEPROM emulation. An example is the M45PExx series from STMicroelectronics, available in densities from 1Mbit to 16Mbits. This product can implement both emulated EEPROM functions (such as storage of system parameters) and serial Flash functions (such as LCD tables or data from data-logging equipment).

Another option for external Flash is available from SST. The SST25LF020A 2Mbits device, for instance, comprises unusually small blocks of 4kB, which promotes efficient use of the device’s capacity in applications that perform multiple write/erase operations. In addition, SST’s devices are rated for 100,000 read/write cycles and can retain data for 100 years.

But while external serial Flash is attractive because of its low price, it is unsuitable for hard real-time applications, where a fast read and write time are both essential.

Traditionally, embedded designers have had no alternative but to use battery-backed SRAM. While the SRAM is ultra-fast, the battery makes this solution large, expensive, intolerant of extreme or hazardous conditions, and prone to failure or a short operating life.

Fortunately, several product introductions offer more attractive options. For instance, Cypress Semiconductor’s nvSRAM product integrates a 22µF or 47µF capacitor with an SRAM, operating as though it were a non-volatile SRAM, so it is both easy to design in and extremely fast.

Another option for replacing battery-backed SRAM is Freescale’s MRAM product (see Figure 3). Fast like SRAM, Freescale’s MRAM devices also offer the best characteristics of EEPROM and Flash. While the currently available range of memory densities is small, Freescale’s roadmap promises much wider choice over the coming months, and MRAM parts offering 1Mbit, 2Mbits and 4Mbits are now in production.

Finally, the designer should not omit FRAM from evaluation which, though far from new, is steadily gaining support in the market. This is largely because the developer of FRAM technology, Ramtron, has now licensed it to a number of IC manufacturers, and so the range of memory densities available and their pricing has become much more attractive.

 


Fig. 3: advantages of MRAM when used as replacement for battery-backed SRAM

 

Conclusion

As a broadline distributor, Future Electronics has had experience assisting thousands of embedded designers across Europe. This experience shows that the memory type most frequently found to be suitable for embedded designs is on-board Flash, but it is not always the right choice. The job of the embedded designer is not simply to create a product that works, but to create a product that works at the lowest total cost (including the cost of manufacturing and design). This mandates the consideration of a hierarchy of memory technologies, from the cheapest upwards.

 

 

Previous Page
Terms of Use  |  Privacy Policy
© 2012 Future Electronics. All rights reserved.

Next Page