# Embedded Systems/Particular Microprocessors

This module of Embedded Systems is a very brief review of the most popular microprocessor families used in embedded systems. We will go into more detail in the next few modules. Each one of these microprocessor families has an entire module dedicated to that family of processors.
The microprocessor families we will discuss are:
* 8051 Microcontroller 8 bit
* Atmel AVR 8 bit
* Atmel AVR32
* Microchip PIC Microcontroller (this family includes the code-compatible Parallax SX chips) 8 bit
* Microchip dsPIC microcontroller 16 bit: review: Circuit Cellar: "Are You Up for 16 Bits? A look at Microchip's Family of 16-Bit Microcontrollers by Jeff Bachiochi 2007; example application: µWatch D-I-Y open source scientific calculator watch
* Freescale Microcontrollers
* The Zilog Z8 Series (Z8, Z8encore, Z8XP)
* Cypress PSoC Microcontroller
* Texas Instruments MSP430 microcontrollers 16 bit
* ARM Microprocessors (this family includes the Philips LPC210x ARM microcontrollers, the discontinued Intel w:StrongARM, Atmel AT91RM9200, and the Intel XScale microprocessors )
* x86 microprocessors

## brief selection guide

For many embedded systems, any of these microcontrollers would be more than adequate.
* TI MSP430 has the lowest power consumption. In sleep mode, 0.3 µW = 3 V * 0.1 µA. Some chips in 2xx and 4xx series include 12-bit DACs.
* The Cypress PSoC has more than one true analog output. Using sleep mode, power consumption as low as 21 µW = 5 V * 4.2 µA . (You can get analog output from the other chips by using an external ADC, or by faking it with a PWM output and some low-pass filtering.) Most Cypress PSoC microcontrollers come in both DIP and SMT versions.
* Many of these series include microcontrollers with integrated 10 bit ADCs, but Atmel AVR 8 bit series (as of early 2006) had the lowest-price chip that included such an ADC, as well as another chip with the lowest cost/ADC. Most Atmel AVR 8 bit microcontrollers come in both DIP and SMT versions.
* If you need a very tiny chip, the Atmel AVR, PIC, PSoC1, and Freescale microcontroller lines all include tiny 8-pin SOIC microprocessors.
* If you want a 32 bit processor, some Philips ARM processors and Freescale Coldfire processors are now under $5 for one. (only comes in LQFP64 ?).
* If you want a 32-bit processor, and you want it in a (relatively) easy-to-prototype DIP package, and you want it currently in production, your choices are extremely limited:
** The 32-bit Parallax Propeller (w:Parallax Propeller)
** The 32-bit LPC1114FN28/102 ARM processor
** The 32-bit PIC32MX210F016B-I/SP MIPS processor
* Many people and several commercial products run Linux on a XScale microprocessor or a Atmel AT91RM9200 (ARM core), without a heatsink or fan. Linux has also been ported to the Atmel AVR32 AP7 family (only comes in a 208-pin VQFP). Linux has also been ported to Freescale 68k/ColdFire processors. I don't think Linux has been ported to any of the other processors mentioned above.
* If you often want to download and run new code on the processor, it makes things easier if the processor is a "Princeton architecture" that can execute instructions in RAM—a processor such as a MSP430 or ARM processor or PIC32 MIPS processor or the Parallax Propeller or Freescale RS08 or M·CORE. It is more difficult (but, as the Arduino demonstrates, not impossible) to download and run new code on a "Harvard architecture" that cannot execute instructions in RAM, such as most 8051 and Microchip PIC and Atmel AVR chips.

## USB interface

(FIXME: very incomplete)

### standard PC as host, microcontroller as device

There are a variety of ways to connect a microcontroller to a USB host.
* Some microcontrollers (such as some 18x series PICmicro, 24x94 series (x = 7, 8, 9) PSoC and some Philips ARM microcontrollers and some Atmel ARM microcontrollers and the Freescale MC9S08JS16) that have a built-in "Full Speed" USB device interface.
* practically all microcontrollers have a UART. You can add a USB adapter that interfaces between that UART and USB, such as some based on the CP2102 chip and some based on the FTDI chips. Most of these adapters are designed to have the microcontroller at the device end, and a PC on the host end. These adapters are full speed (12Mbps) USB devices, but don't expect them to be fast, most of them emulate a serial port with baud rates up to about 1 Mbps.
* practically all microcontrollers can act as an I2C master. Some adapters based on the PDIUSBD11 chip and PDIUSBD12 chip from ST-NXP Wireless (formerly a division of Philips Semiconductors) connect to an I2C port or a GPIO port of the microcontroller, and act as a USB peripheral.
* Many microcontrollers (such as the Atmel ATmega16) can be programmed to be a Low speed USB device with a few external passive components .
** See Embedded Systems/Atmel AVR#USB Interface

### microcontroller as host, connecting to some USB device

There are a variety of ways to connect a microcontroller to a USB device.
* practically all microcontrollers have a UART, and some USB adapters can be set up with a microcontroller as the host, and some USB device (a mouse, keyboard, or flash drive) on the device end.
** "Interfacing a USB Flash Drive to a PIC Microcontroller" by Fred Dart 2008
* a few microcontrollers (such as the Parallax Propeller) can be programmed to talk to a few USB peripherals with a few external passive components .

### microcontroller as both a device (connected to a standard PC) and a host (connected to one or more USB devices)

How ? ... USB on-the-go (OTG) defines a single socket that automatically switches between host and device ... for example, a camera with a single USB socket that acts as a device when plugged into a PC (for uploading photos), but acts like a host when plugged into a printer (for printing photos directly without a PC) ...
* The LUFA library allows the USB-enabled AVR microcontrollers to act as a USB Host, slave or OTG device.
* Most Atmel 32-bit AVR UC3 microcontrollers support full-speed (12 Mbps) USB 2.0 with USB Host, slave, or On-The-Go (OTG) capability
* The PIC24FJ32GB002 and the pin-compatible PIC24FJ64GB002—are they the only chips available that both (a) are available in DIP package and (b) have built-in USB OTG hardware?

### other details on USB

For more details on USB, see the Serial Programming:USB Technical Manual.

## References

* ↑ RepRap wiki: "32 bit microcontroller in a though-hole package"
* ↑ "Understanding USB On-The-Go" by Kosta Koeman 2001

## Further reading
### Reviews contrasting different microprocessors

* "How to choose a MCU platform?" has a nice review of many different processors.
* Instructables: "How to choose a MicroController" by westfw
* Ladyada: "PIC vs. AVR" "OK, I know what you people want. You want ultimate fighting, embedded E.E. style. You want to know WHICH IS BETTER, PIC OR AVR?"
* Mike Harrison: "Which is better: PIC or AVR ?"
* CNCzone: "Microchip vs Atmel"
* PSoC Developer "PSoC VS PIC/AVR/ATMEL/8051" has a brief comparison review of a few Freescale, Microchip, and Cypress CPUs.

### Further reading

* Once you've picked out a processor, you'll want to know Embedded Systems/Where To Buy it.
* Robotics: Single Board Computers discusses "processor modules" that include the CPU and a few support chips in a convenient package.
* Getting started with microcontrollers, part of the "Microcontroller Primer FAQ" by Russ Hersch
* microcontrollers for wireless sensor network devices