Integrated memory is a hallmark of the microcontroller (MCU) technology sector, and indeed many applications work sufficiently with the memory available on mainstream MCUs. However, media-centric applications often require either additional code memory to handle a complex audio or graphics algorithm, or additional data memory to store digital representations of larger audio or graphics elements. You may also find that system footprint requirements might be better suited by a miniature MCU, and an even smaller memory IC, than by a larger MCU. Fortunately, there are many options for adding code or data memory to MCUs. In this article, we will cover the memory interface options along with the readily available volatile and nonvolatile memory types.
To get started, let's discuss memory types that are not typically viable for use with MCUs – specifically memories with a parallel data bus. There may be applications in which parallel memory can be used, and MCUs typically include a number of I/O ports that could be used to interface with parallel memory. But generally, you need the I/O pins on an MCU for the application at hand. So here we will focus primarily on memory that uses a more pin-efficient serial interface of some sort to connect with the MCU.
There is a surprisingly broad range of choice when it comes to serial interfaces for MCUs. The list includes options such as I²C and SPI (Serial Peripheral Interface) that are de facto, although not precisely-defined, industry standards. Proprietary options include Microchip Technology's UNI/O and Maxim Integrated Products' 1-Wire.
While all of these interfaces are serial in nature, they require varying number of signals to consummate the connection. So let's dig a bit deeper.
I²C was originally defined by Philips, but you do not today require a license to use the technology. I²C is a two-wire, master-slave interface that relies on a bidirectional data line and a clock signal. Many I²C implementations work at relatively low speeds, such as 10 or 100 Kbits/s. However, the latest version of the standard includes support for 400-kbit/s, 1-Mbit/s, and 3.4-Mbit/s modes. Note that the SMBus (System Management Bus) defined by Intel is derived from I²C.
SPI generally requires four signals – dedicated input and output data lines for full-duplex communications, along with clock and slave-select lines. An SPI master may need multiple slave-select outputs if it is to be used with multiple slave devices. There are also options for using SPI in two- and three-wire implementations and there is no precise standard for such usage. Some implementations even forego the slave-select signal, while others use a single bi-directional data line meaning the interface can only work in half-duplex mode.
SPI is generally faster than I²C with implementations often running clocks upwards of 100 MHz, although 20 to 40 MHz is more typical. You will also find that some implementations double or quadruple the number of data lines to linearly scale speed upward. However, doing so quickly matches or exceeds the pin utilization of parallel interfaces.
The 1-Wire bus was developed by Dallas Semiconductor before that company was acquired by Maxim. As the name implies, the interface requires a single line between master and slave. Performance is on the low end with implementations generally operating at 14.4 Kbits/s, although there is a 125-kbit/s mode that Maxim calls Overdrive.
Similarly, Microchip's UNI/O interface uses a single signal as depicted in Figure 1, showing a connection between an MCU and an EEPROM. The interface uses Manchester encoding in which the clock is embedded with the data, and can support clock rates as high as 100 kHz.
Figure 1: The Microchip UNI/O interface uses a single conductor to link an MCU and a slave device such as EEPROM memory.
Microchip touts several benefits of UNI/O, starting with the fact that it requires a single pin on an MCU. As we covered in a previous TechZone article, (“Miniature Six-Pin MCUs Offer Surprising Functionality”) there are a plethora of Microchip PIC10 family MCUs that come in 6- and 8-pin packages, yet you could even use UNI/O with those parts to expand memory or other functionality. Indeed, you can pair such an MCU with Microchip UNI/O EEPROMs in a miniature 3-pin SOT-23 package and realize an extremely small system footprint. The available EEPROMs range in capacity from 128 bytes to 2 Kbytes. The full range of UNI/O EPROMs includes a number of different package types such as 8-pin SOIC and even an 8-pin DIP.
Nonvolatile memory is also the primary product type available from Maxim for the 1-Wire interface (Figure 2). The company offers EEPROMs and one-time-programmable (OTP) EPROMs. Package options include the three-pin SOT-23 along with 3-pin TO92 and others. Maxim offers memory organized in 1-, 4-, and 8-bit widths. The largest device is the 20-kbit DS28EC20, organized as 80 pages of 256-bit memory.
To implement the 1-Wire interface, you can use a standard MCU I/O pin and what is often called bit-banging software to implement the protocol. Maxim does offer the DS248S 1-Wire IC that bridges an I²C interface to 1-Wire, as shown in Figure 2.
Figure 2: Maxim Integrated Products offers memory and other peripherals that utilize the 1-Wire interface and can be realized by a dedicated IC or with a typical MCU I/O line.
For the media-centric applications that we discussed at the start, you will likely need access to a broader selection of volatile and nonvolatile memory types including SRAM and perhaps flash. You will likely find yourself choosing between SPI and I²C to connect such memory. To get a broad overview of the available products, you might want to run a vendor-independent search for available products on the Hotenda website.
Search for SPI and SRAM, and you will find that Microchip, ON Semiconductor, and Cypress Semiconductor offer such products. Actually, in the case of Cypress, the products are NVSRAM ICs that, as the prefix implies, are nonvolatile. Cypress actually offers the fastest and most capacious product in the group with the CY14B101P that stores 128 Kbytes and supports 40-MHz access speeds. Microchip and ON Semiconductor both offer SRAMs up to 32 Kbytes in size with access speeds of 20 MHz.
Here are some other quick searches that you might perform to explore product availability:
- SPI-based Flash memory
- SPI-based EEPROM
- I²C-base SRAM
- I²C-based EEPROM
We should discuss one final difference between I²C and SPI in terms of pin allocation on an MCU when you need to connect multiple memory devices. SPI offers higher performance, but pin requirements escalate beyond the four-pin interface when you need to address multiple memories, whereas I²C can address multiple memory ICs using just the two wires. As Figure 3 shows, you will need to dedicate additional MCU I/O lines as slave select signals in the case of SPI.
Figure 3: SPI offers superior performance to I²C, but if you need to connect multiple memory devices to the former, you will need additional select lines.
If you want to experiment with serial memory, Microchip offers a PI starter kit that can quickly bring you up to speed. The kit supports I²C, SPI, and UNI/O EEPROM. It also includes the company's Total Endurance software model that allows you to predict the long-term reliability and endurance of an EEPROM-based design.
In summary, engineers should look beyond integrated memory when evaluating microcontrollers for media-centric applications. Do not hesitate to consider using external memory in your design, as you might find that the combination of miniature MCU and memory devices is smaller, less costly, and lower power than an MCU with a larger memory complement. With MCU performance escalating and the chips tackling more media-centric applications, external code or data memory may be a mandate in many such applications.