Microcontroller Solutions TechZone Magazine, April 2011 - Digikey
Microcontroller Solutions TechZone Magazine, April 2011 - Digikey
Microcontroller Solutions TechZone Magazine, April 2011 - Digikey
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Introducing a Second MCU<br />
to Embedded Designs<br />
by Nicholas Cravotta<br />
There are numerous reasons to add a second<br />
MCU to your design and numerous errors to<br />
avoid once you do. This article considers the<br />
arguments and options while pointing out the<br />
pitfalls along the way.<br />
With the wide variety of processors available today, there are a<br />
great many reasons why you may find it to be a more cost-effective<br />
choice to add new features to an application by introducing a<br />
second microcontroller (MCU) or microprocessor (MPU) to your<br />
design rather than trying to perform every task on a single, higher<br />
performance processor:<br />
• Cost: Migrating to a higher performance system MPU can have a<br />
higher cost differential than adding an 8- or 16-bit MCU to take<br />
on the added load.<br />
• Power: Rather than expend the power to have the main<br />
application processor continuously turn itself on to perform a<br />
relatively simple operation such as monitoring a sensor bank<br />
or checking if a key has been pressed, an 8-bit processor<br />
can be introduced to perform these tasks. In essence, the<br />
8-bit processor serves as a “power gate” by letting the main<br />
processor sleep and waking it only when an event occurs that<br />
requires its attention. This is especially effective with resistive<br />
and surface capacitive touchscreens.<br />
• Determinism: User interface (UI) functions involving compute<br />
intensive tasks such as animation or audio can stress the<br />
real-time deterministic behavior of a system. Rather than risk the<br />
reliability of critical tasks such as motor control, a second MCU<br />
can assume all “real-time” UI responsibilities.<br />
• Diversity: Many systems can benefit from a modular design. For<br />
example, a display module can be implemented with a different<br />
processor to provide additional graphics, or streaming video<br />
capabilities. By taking a modular approach, the main application<br />
code does not need to be changed to add new features to the<br />
system or to support different models.<br />
• Simplicity: A product line may offer a wide variety of options.<br />
For example, a product may have four screens, three keyboards,<br />
and three connectivity options. When a single processor is<br />
used, the design team has to maintain, test, and verify a<br />
separate code version for each possible variant (4x3x3=36<br />
distinct variants). When a secondary processor is used to<br />
implement a new function, maintenance is required only<br />
for each option (4+3+3=10). Note that with the first option,<br />
the entire system needs to be tested and verified with every<br />
variant, a complex and time-consuming process. When using<br />
the second option, the main application code only needs to be<br />
verified once. Each of the options can be verified separately<br />
and with significantly less complexity.<br />
• Conservation of I/O: An MCU can appear to be several devices<br />
over an interface by responding to several addresses. For<br />
example, the main application processor could issue a command<br />
to turn on a fan which is intercepted by an MCU serving as a<br />
virtual hub. This is an effective way to conserve I/O on the main<br />
application processor since only one communication peripheral<br />
is required to read and control multiple devices.<br />
• Certification: Changing the user interface or introducing a new<br />
interface like Wi-Fi to the main system requires the entire design<br />
to be recertified for some markets. Implementing these functions<br />
as an add-on module with a separate processor simplifies<br />
the recertification process, significantly accelerating both<br />
development and time-to-market.<br />
UART, I 2 C, and SPI<br />
There are many options available for interconnecting processors.<br />
The most basic interfaces used for this purpose are Universal<br />
Asynchronous Receiver-Transmitter (UART), Inter-Integrated Circuit<br />
(I 2 C), and Serial Peripheral Interface (SPI). Today, many processors<br />
offer hardware and software support for one or more of these<br />
interfaces. For example, STMicroelectronicss’ STM32 Cortex-M3 32-<br />
bit processors and 8-bit STM8L MCUs support all three. Alternatively,<br />
Cypress’ PSoC family of programmable system-on-chip processors<br />
have analog and digital blocks which can be configured to provide<br />
multiple instances of each of these interfaces, allowing the interface<br />
mix to be altered as required for different target markets. The<br />
question becomes how many interfaces you’re going to need.<br />
A UART operates up to 250 kbps, compared to 100 to 400 kbps for<br />
I 2 C. SPI, which supplies its own clock, can operate at speeds over<br />
1 Mbps. A UART link can typically be implemented in software using<br />
an interrupt-based driver, so long as the driver doesn’t place too much<br />
load or latency on the processor based on the application’s needs. An<br />
I 2 C master can often be implemented in software, but a slave needs to<br />
www.digikey.ca/microcontroller<br />
15