# Embedded Systems/Texas Instruments MSP430 microcontrollers

The MSP430 is a family of 16-bit RISC microcontrollers produced by Texas Instruments. The MSP430 microcontroller was developed at Texas Instruments in 1993. At the beginning Texas Instruments only offered the MSP430 in Europe. Since 1997 the MSP430 microcontroller family is offered world wide. The most important feature of the MSP430 is its low power consumption. However, the flexibility of its peripheral modules and the easy way to use it is the reason why this microcontroller is also used as a general purpose microcontroller.

## Architecture

The MSP430 microcontroller is based on a von-Neumann architecture. The MSP430 von-Neumann architecture has one address space shared with special function registers (SFRs), peripheral control registers, RAM, and Flash/ROM memory. At the moment there are two compatible CPUs existing within the MSP430 microcontroller family. The MSP430 CPU uses 16-bit CPU register and 16-bit Program Counter. This basically means that with such a CPU an address range of 64kBytes could be addressed. Due to the von-Neumann architecture the address range covers peripheral control registers (address 0x0000 to 0x01FF), RAM (starting at address 0x0200), and for example Flash memory (e.g. for an MSP430F169 the Flash memory starts at address 0x1000). So the MSP430 derivatives with the MSP430 CPU usually have a maximum Flash memory of 60KByte. The other CPU is the MSP430 CPUx (or MSP430X). This is an extended CPU. The CPU registers are 20-bit registers. Also the Program Counter is a 20-bit register, which allows to address memory above the 64KByte limit that was seen before. Usually all MSP430s with a Flash memory above 60kByte Flash have the CPUx. Because the CPUx is based on MSP430 CPU the software that was written on a MSP430 CPU device is also running on MSP430 CPUx chips.

## Peripheral Modules
### Analog Peripheral Modules
#### ADC12

The ADC12 module is a 12-bit SAR A/D converter. There is an input multiplexer that allows to select different internal or external analog input signals. Internal analog signals are a temperature sensor signal, half of the supply voltage (that could be used for a battery check), or the external positive and negative reference voltages. Sample rate can be adjusted by software and it can be up to 200ksps. Sample time can be defined by an integrated Sample Timer, by software using a control bit, or by output signals of Timer modules that are also available on MSP430. There are external pins or an integrated reference that can be selected as a reference voltage for the A/D converter core. The internal reference can be switched in 2.5V or 1.5V mode. Separate activation of the reference and ADC core allows reduction of current consumption.

#### ADC10

The ADC10 module looks similar like the ADC12. The ADC10 module is a SAR A/D converter. There is an integrated reference (1.5V, 2.5V, or external reference can be chosen). A sample timer allows the adjustment of the sample time. Beside the analog inputs there is also the possibility to choose a Vcc half voltage or a temperature sensor signal (integrated temperature sensor) as the analog input signal. Vcc half voltage can be used to measure the battery voltage that is usually directly applied to the Vcc pins of the MSP430. Main difference compared with ADC12 is the realization of the autoscan function. The ADC10 module uses a Data Transfer Controller (DTC) to move the conversion results to a definable source address - this means conversion results can be stored in RAM, Flash, or peripheral control registers. The sample rate of the ADC10 module is also in the range of up to 200ksps.

#### DAC12

The DAC12 module is a 12-bit monotonic voltage output D/A converter. Usually there are existing several DAC channels (up to 2). It can be configured in 8-bit or 12-bit output resolution. It was designed for optimized power consumption. So features can be found like programmable settling time versus power consumption. It is possible to select either the ADC12 reference or an external reference voltage as the reference voltage for the DAC12. Self-calibration option for offset correction and synchronized update capability for multiple DAC12 channels are available.

#### Analog Comparator

The Comparator_A or Comparator_A+ modules are analog comparators. It is possible to choose chip internal thresholds (0.25*Vcc, 0.5*Vcc, or a diode voltage as reference or temperature sensor). The internal connection of the comparator output to a capture input of a timer module allows charge/discharge time measurements, which makes it simple to realize a resistive measurement (e.g. using NTC to measure temperature). Especially ratiometric measurements allow to do conversion with a resolution of around 11-bits and higher.

### Digital Peripheral Modules
## Development Tools
### A simple and cheap Starter Kit (eZ430-F2013)

This is a simple and cheap tool that is perfect to start with MSP430. It supports the MSP430F20x1, MSP430F20x2, and MSP430F20x3 devices. The eZ430-F2013 tool looks like an USB Stick. The USB stick consist of two parts. First the USB emulator and a removable target board. The eZ430-F2013 is delivered with one target board that uses an MSP430F2013. If someone wants to use an MSP430F2012 instead of the 'F2013 there are also a kit with 3 eZ430 target boards using MSP430F2012 available (eZ430-T2012).

### A cheap wireless Starter Kit (eZ430-RF2500)

This one uses the same USB emulator than the eZ430-F2013. However, there are different target boards that uses beside an MSP430F2274 and CC2500. The kit is delivered with 2 RF boards, one battery holder, the USB emulator, and a CD ROM.

### The LaunchPad (MSP-EXP430G2)

A very low-cost ($4.30) experimenter's board created with beginners and hobbyists in mind. Comes as a complete, assembled product (except for the header pins) with two MSP430 controllers, an external crystal, a USB cable, and freely downloadable development environments.

## Further reading

* "Getting started with the MSP430"
* MSP430 wiki
* the Arch1 wiki mentions MSP430 programming
* MSP430 Bugspray Database
* FreeRTOS for MSP430
* mspgcc: The GCC toolchain for the Texas Instruments MSP430 MCUs, based on GCC 3
* mspgcc4: The GCC toolchain for the Texas Instruments MSP430 MCUs, based on GCC 4
* The LaunchPad on ti.com