TI MSP430

from Wikipedia, the free encyclopedia

The MSP430 is a 16-bit RISC - microcontroller company Texas Instruments . It was developed at the German branch of Texas Instruments in Freising in the early 1990s and came onto the market in 1993. The microcontroller is optimized for applications with the lowest possible power consumption. The processor core is by means of the compiler in the C programming language and / or assembler programmable. The controller is available in different versions. Texas Instruments is constantly expanding the range, which indicates a great success for this line of controllers. Typical applications are devices with long- life batteries , such as heat meters , heat cost allocators , dive computers or blood pressure monitors in the medical field.

The MCU is a quasi-standard in electronics, but it is increasingly being replaced by Cortex-M derivatives .

MSP430 soldered onto a circuit board
Close-up of the MSP430's semiconductor chip

Memory allocation

The MSP430 has a classic Von Neumann architecture . The size of the addressable memory is limited to 64 kByte for most of the derivatives. Memory sizes are up to 256 kByte FLASH and up to 16 kByte RAM (currently [November 2008] also in the same module). In all derivatives, approx. 2 kB of the lower addressable 64 kB are reserved for internal functions (such as a boot loader ), so that with the two largest 16-bit memory configurations, 60 kB FLASH with 2 kB RAM or 48 kB FLASH with 10 kByte RAM are available.

Since November 2006, TI has also been offering a family with a so-called MSP430X CPU. This is based on a memory model that can address up to 1 Mbyte of memory. The address bus has 20 bits, all registers (except for the status register R2 / SR) are therefore no longer 16 bits wide, but 20 bits. The commands available in the "normal" CPUs are still available without change. The internal processing had to be adapted to the larger address width, for example one word more must be written to the stack with the CALL command, since 4 more bits have to be stored as a return address. Modules are available with up to 120 kByte flash / 4 kByte RAM or 116 kByte flash / 8 kByte RAM, all with LCD drivers.

In the bottom 16 bytes (address 0000 h to 000F h) there are special registers (SFR, Special Function Register) for the interrupt and "module" control. The registers of the 8-bit periphery occupy the next 240 bytes (address 0010 h to 00FF h). Up to this point, byte-wise memory access is necessary. The next 255 bytes (address 0100 h to 01FF h) are reserved for the 16-bit periphery. From here, the memory is accessed word by word.

The RAM is located from the 513rd byte (address 0200 h to 09FF h). With the larger RAM configurations (larger than 2 kByte) this is actually higher up in the memory (address 1100 h to 38FF h), but is partly mirrored in the lower address area. In between there are boot and information memories (address 0C00 h to 0FFF h or 1000 h to 10FF h).

The information memory, like the code memory, is a flash memory whose special feature is the division into two 128-byte segments that can be used as a "buffer" for data that needs to be changed from time to time. The remaining FLASH memory (for the program code and constants) has segments of 512 bytes. It is generally in the memory area 1100 h to FFFF h, but depending on the memory configuration (more RAM or smaller FLASH) it will only be from address FC00 h (for 1 kByte FLASH). In addition, the top 32 bytes (address FFE0 h to FFFF h) of the memory are reserved for the interrupt vectors, which are only used when required. If no interrupts are used, the memory for their vectors can also be used as program memory.

FRAM- based MSP430s have also recently been offered. Compared to Flash, this type of memory can be written to faster and with much less energy. Another advantage of these modules is that there is no rigid boundary between code and data (Flash and RRAM ), but this can be selected as required. The manufacturing process used for the FRAM modules was jointly developed by Ramtron and TI.

Interrupt handling

The MSP430 basically knows 16 interrupt sources, which are prioritized according to their position in the interrupt vectors. Not all sources are assigned in every block; this depends on the expansion of the "internal" periphery.

Several interrupts can occupy the same vector. If this is the case, the software must use appropriate bits to decide which interrupt is currently present. In addition, different interrupts have their "own" vector registers, which can be used to provide up to 10 different sources (expandable up to 128). The timer interrupts are an example.

The MSP430 has several power-down modes, in which command processing is stopped or the clock is switched off. In the lowest mode, the power consumption is 0.4 µA, depending on the type. If you want to implement a real-time clock , approx. 2 µA are required. The CPU can be woken up again by various interrupts .

processor

MSP430 FG438 on the circuit board of a blood glucose meter

The instruction set contains only 27 "basic instructions " and 24 " emulated " instructions, which are composed of the basic instructions. The term “ RISC ” is appropriate for this.

The processing of a command takes 1 to 6 cycles. At clock frequencies of up to 25 MHz, step times down to 40  ns can be achieved. The maximum clock frequency depends on the type and the supply voltage, for example:

  • MSP430 x 1 xx : 4.15 MHz at 1.8 V .. 8 MHz at 3.6 V (linear)
  • MSP430 x 2 xx : 4.15 MHz at 1.8 V, 16 MHz at 3.3 .. 3.6 V (non-linear)
  • MSP430 x 5 xx : 8 MHz at 1.8 V, 25 MHz at 2.4 .. 3.6 V (stepped)

MSP430 microcontrollers can contain an MSP430 core or an MSP430 X core as the processor. The latter processes additional commands in order to operate the registers which have been expanded to 20 bits and to address more than 64 KiBytes (the limit of 16 bits) and is compatible with the MSP430 core (without "X"). From the point of view of the MSP430X instruction set , the extended bit width is "limited" to 32 bits, the 20-bit register width was chosen as the current compromise between addressing scope (1 MiByte) and complexity and energy consumption. If 20 bits are sufficient for certain arithmetic operations, these extended registers can also be used generally (currently only possible in assembler).

architecture

The MSP430 has 16 registers. Register 0 is the program counter (PC), register 1 is the stack pointer (SP, stack pointer ) and register 2 is the processor status register (PS). Register 3 (constant generator, CG) is a pseudo-register that supplies the frequently required constants –1, 0, +1 and +2. These four registers have special functions, but like all the other twelve registers can also be used freely. The possibility of using the program counter or the stack pointer as "free" registers was already used with the PDP-11 . The registers are not addressable; they are not available as a copy in the address space of the MSP430.

Possible addressing types are register addressing (Rn), indexed addressing (X (Rn)), symbolic addressing , absolute addressing , indirect addressing (@Rn), indirect addressing with auto-increment (@ Rn +) and direct addressing for constants. These addressing types are available for the source operand. In the case of instructions with two operands, only register addressing, symbolic addressing, absolute addressing and indexed addressing are available for the target operand.

Internal peripherals ("modules")

The registers of the "internal" periphery ( clock generation , SVS (monitoring of the supply voltage), hardware multiplier , DMA , ports , watchdog , timers , serial interfaces , comparators , ADCs and DACs ) are integrated in the address area (as mentioned above). Depending on the model, this periphery is integrated on the chip. A distinction is made between 8-bit peripherals and 16-bit peripherals.

Clock generation

TI uses three different sources for clock generation, which, depending on requirements, have very low power consumption (32.768 kHz in the form of a clock crystal ), very fast wake-up after an interrupt (internal RC oscillator , 6 µs time until the nominal RC clock frequency is reached) or high frequency (up to 16 MHz). The MSP430 is very well suited for overclocking: the low frequency oscillator can be operated with a 100 kHz crystal (around 200% overclocking), and the HF oscillator can be overclocked by 100%, at least at room temperature and at the maximum permissible operating voltage.

SVS

The Supply Voltage Supervisor, also known as Brown Out Reset or Brown Out Detector, monitors the supply voltage and enables the system to be restarted in a controlled manner (reset) even if the minimum voltage is briefly undershot. If the voltage falls below the minimum, unpredictable errors can occur in the system, which can lead to unwanted program executions or freezes. With the SVS, such errors are avoided and a controlled restart is carried out, even without switching off the supply voltage.

Hardware multiplier

The hardware multiplier masters the multiplication of unsigned and signed 8-bit and 16-bit numbers, resulting in a number of up to 32 bits. The youngest child of the MSP430 family can even handle 32-bit numbers and a 64-bit result. He is also capable of unsigned and signed multiplication and counting (MAC, a domain of DSPs ). The first operand of these four operations must be stored in a special register, the second operand always in the same register. The result is always in the two same output registers. It is automatically available three (!) Measures after the second operand has been stored.

DMA

With the help of the DMA controller, data can be transferred very quickly from one memory area to another without the involvement of the CPU. During this time the CPU cannot access the bus, which is why it has to be stopped. However, the DMA transfer is also permitted in the low-power modes, whereby the CPU clock must be increased. Another advantage of the DMA module is that it can be used in the “tandem” principle, which means that the clock cycles are divided alternately between the CPU and DMA. This is ideal, for example, for building a video image without having to use the CPU. The possibility of connecting the DMA units in series (mostly 3) means that a digital filter can also be implemented, which can be used, for example, for audio applications with the aid of the AD and DA converters. Another very helpful function with the DMA is to move memory contents, which saves considerable time and programming effort. It is very interesting for the MSP430F16XX series, for example, because they have more memory (RAM). Copying from RAM to FLASH can also be made easier with DMA than with software.

Ports

Some of the ports are interrupt-capable, which means that the MSP430 can be woken up from a low-power mode via them. In such a state, the MSP430 consumes the least amount of energy (approx. 0.4 µA). The ports themselves can only drive and consume very little current (approx. 6 mA, whereby the total current in the component is by far not a multiple of the number of pins of this value, depending on the type). The names of the ports are as follows: P1.0 - P2.5, so there are e.g. B. two registers on the MSP430G2xxxx (P1, P2), which then each have individual outputs (P1.0). The individual outputs can be used both as inputs and outputs. All outputs / inputs can be defined at once via the port, or each output / input can be defined individually.

Watchdog

The watchdog timer is used when the system should be operable again after a deadlock without the user having to do anything . To this end, the watchdog counts up a timer that the application must always set to zero. If the application is unable to do this due to a deadlock (it is generally said that it has lost its way), the watchdog triggers a reset. The system starts from the beginning and can be operated again (even if the user does not necessarily like it if he has to start over). This ensures that the program returns to a defined operating state even after an intense external disturbance, for example ESD discharge via the processor. Program execution errors that occur very rarely and are not found during tests can also be caught in this way.

The function of the watchdog timer can, however, also be switched off if the above-mentioned functionality is not desired or is disruptive. The watchdog timer can also be used as an additional counter, for example to implement a real-time clock. This is done by configuring the counter to trigger an interrupt every second and then counting up the seconds in the interrupt. Disadvantage of this "software clock" compared to an external clock circuit: If the MSP430 is completely switched off, ie no longer has the opportunity to trigger the interrupt, the time can of course not be counted and must then be re-initialized the next time it is started.

timer

The timers basically have 16 bits. They can be addressed by different clocks, also by external events. This enables very short timer times in the range of a few hundred nanoseconds (fast 16 MHz cycle) to timer times of any length (many months and years due to very slow external signals). Even with the second separate time base with 32 kHz, direct timer times of up to two seconds can be achieved, and if an additional register is used, up to 1.5 days. Timers can also wake up the CPU from a low-power mode. In order for them to run - they need a clock cycle - the power-saving functionality cannot be driven as high as with the ports, where practically no internal peripherals are necessary for support.

Serial interfaces

For the serial interfaces, UART , SPI , USB (slave only) and I²C are currently implemented in hardware as protocols . Others such as B. LIN should follow. CAN will not be supported by the MSP430 for the foreseeable future, as the manufacturing process used to manufacture the controllers is not suitable for the temperature range in the automotive sector. The baud rate could theoretically up to 16 Mbit / s to be set. Asynchronous communication runs safely up to 115.2 kbit / s, SPI works around 1 Mbit / s and I²C in the supported modes up to 400 kbit / s.

Comparators

With the comparators, analog voltages can be compared against different reference voltages. The reference voltage can be generated internally (0.5 V CC , 0.25 V CC or around 0.55 V) or externally. The result can be used to trigger interrupts or trigger timers. With the triggered timer, PWM signals can be generated that are pulse-width modulated as a function of an input signal.

You can also switch the comparison directly to a port, CAOUT. If the 2 input ports of the comparator are marked with and , then CAOUT is high when the voltage is higher . Which of the two ports and which one can be set using the CARSEL and CAEX bits in the Comparator Control Register.

ADCs

The AD converters have a resolution of 10, 12, 14 or 16 bits, whereby the SAR (successive approximation), slope (ramp) or sigma-delta process is used as the conversion process, depending on the type of MSP430 . As with the comparators, an AD converter also requires a reference voltage that can be generated internally or externally. The sampling rate can nominally be up to 5 MHz, with which signals up to 2.5 MHz could theoretically be sampled. The data obtained with such a high sampling rate could hardly be processed by the CPU, since this would only be available for 3.2 clock cycles (16 MHz clock) per sample value.

CRC16

The CRC16 module generates a CRC code based on a sequence of data values ​​and can be used for checking and correcting the data. The CRC16 module check code is based on the CRC-CCITT standard. This module can ideally be used for data transmission via TCP / IP or with connected W-LAN modules. But it is also suitable as a test code generator when writing to magnetic data carriers such as floppy disks or hard drives.

DACs

The DACs have a resolution of 8 or 12 bits. The analog output signal can therefore be varied in 256 or 4096 steps. As with the comparators and ADCs, the internal or external references can be used as the reference voltage. As the “output format”, the binary data can be output directly or as a two's complement . The output amplifier can be automatically calibrated so that the output voltage correctly follows the digital values. The DAC itself can be clocked with up to 550 kHz, which accordingly enables a theoretical output frequency of up to 275 kHz.

Operational amplifier

Modules with integrated operational amplifiers make it possible to amplify analog voltages (which benefits the use in measuring systems). The operational amplifiers, like the rest of the component, are energy-saving and are supplied from a single voltage source (single supply, low current). The output voltage can reach the supply voltage (rail to rail). The settling time can be programmed to be shorter with higher power consumption. Different resistors for the feedback are built in for a programmable gain.

LCD driver

The LCD driver built into the 4xx series and 6xx series components can control static and multiplexed LCDs. Up to 40 segments and 4 common connections (backplanes) are possible. The display memory with 20 bytes, which is shown in the address range 0091 h to 00A4 h, is sufficient for this . The contrast can be adjusted via external resistors.

Real time clock

The real-time clock (RTC, English real time clock ) can be used as general-purpose 32-bit counter (counter mode) or as a clock with calendar function (calendar mode). In counting mode, the RTC module includes two independent 8-bit timers, which can also be interconnected as a 16-bit timer. Both counters are then timers and can be read and written by the software. The calendar function takes into account months with fewer than 31 days and even leap years. The RTC module has alarm registers for the wake-up function and supports hardware interrupts. In contrast to the timers, the real-time clock "survives" resets.

USB

MSP430F55XX with integrated Universal Serial Bus (USB) are available.

  • Full-speed universal serial bus (USB) device with integrated physical transmission unit and SIE
  • Integrated 3.3 V / 1.8 V USB power supply system, suitable for self-powered and bus-powered USB devices without additional voltage regulators
  • Integrated frequency generator (PLL) for USB crystal required
  • Eight input and eight output USB endpoints (non-isochronous transfer mode) available
  • USB bootloader starts up with a number of different crystals (not just one specific crystal)

With the USB interface, for example, an HID , a serial USB device or a USB stick can be implemented, but not controlled. Its assigned dual-port RAM (2 KByte) can be added as additional memory to the internal memory, which is a bit scarce anyway, when the USB module is not used. Isochronous data transfer is not intended, so the video and audio device class cannot be implemented.

Further peripheral modules

Since the shrinking at the end of 2008 there have been some types of the MSP430X5xx series with an integrated RF transceiver, LDO voltage regulator and an AES cryptoengine.

programming

C is the ideal programming language . The architecture is designed for this. Pointers , arrays, and stacks are easy to implement. Although the MSP430 has a RISC instruction set, it partially allows a C expression to be translated into a single machine instruction thanks to the different addressing modes. Various commercial and free C compilers are available.

List of available C compilers (incomplete selection)

Surname Manufacturer Versions available
MSP-CCE430 TI Freeware version available. Up to 16 kB of code are allowed in the new version 3.
MSP430-GCC TI GNU Compiler Collection for MSP430. Full open source compiler and debug stack
IAR EW430 Kickstart TI Freeware, de facto from IAR, with up to 4 kB code
AQ430 Quadravox Demo version with code limitation to 4 kB
Crossworks Rowley Associates 30-day demo
Hi-tech HI-TECH software Time-limited demo version available
HFW_430 HiTex Full version that requires MSP-EVK330.
EW430 IAR 30-day demo version with a 4 kB code limit
ICC430 Imagecraft 30-day demo
MCC-430 MicroCOSM Demo with code limitation to 4 kB
MSPGCC SourceForge team Free GNU variant (discontinued, replaced by the GCC from Texas Instruments)
LLVM-MSP430 Different developers Backend for the LLVM

There are also users who program the MSP430 in assembler. Since the C compilers can usually be set to be highly optimizing and actually already are, this is really only necessary for time-critical application parts. Most C compilers can incorporate assembler into the C code.

FORTH is a somewhat unusual but very efficient programming and test system . In addition to some open source FORTH projects, there is a very good professional FORTH development system "Swift-X". Forth uses Reverse Polish Notation (UPN).

The programming of the block and the debugging can be implemented via a JTAG interface . For this purpose, TI offers hardware called a FLASH emulation tool (FET) that accesses the JTAG port via the parallel port or the USB interface of the PC. In the newest versions (MSP430F20xx) the JTAG port (which actually has at least four signal lines and reset) has been reduced to 2 signal lines by an interface that TI calls "Spy-Bi-Wire", so that only four connections are left on a target system for debugging are necessary: ​​two for Spy Bi-Wire, ground and supply voltage.

The modern FET tool is supplied as a USB stick. If the target system requires a sufficiently low supply current, USB is sufficient and an external power supply is not necessary.

The MSP430 LaunchPad (MSP-EXP430G2), actually an evaluation board, can also be used officially for programming via Spy Bi-Wire. The required connections can be found on the terminal strip J3 and the unassembled terminal strip J4.

List of FLASH Emulation Tools (FET)

Surname Manufacturer interface protocol
MSP-FET430PIF TI Parallel port JTAG
MSP-FET430UIF TI USB interface JTAG, Spy-Bi-Wire
MSP-430 LaunchPad TI USB interface Spy-Bi-Wire
eZ430-F2013 TI USB interface Spy-Bi-Wire
eZ430-RF2500 TI USB interface Spy-Bi-Wire
FETP SoftBaugh Parallel port JTAG
USBP SoftBaugh USB interface JTAG, Spy-Bi-Wire
MSP430-JTAG Olimex Parallel port JTAG
MSP430-JTAG-ISO Olimex USB interface JTAG, Spy-Bi-Wire
MSP430-JTAG-Tiny Olimex USB interface JTAG, Spy-Bi-Wire
MSP430-JTAG-RF Olimex USB interface JTAG, Spy-Bi-Wire
FlashPro-CC Elprotronic USB interface JTAG, Spy-Bi-Wire, BSL
VisSim / ECD Visual Solutions USB interface JTAG, Spy-Bi-Wire
LA-3713 Lauterbach USB interface / Ethernet JTAG, Spy-bi-Wire

In addition, each programmable MSP 430 contains a bootstrap loader that allows the modules to be programmed via a UART interface. Details are given in a TI Application Note.

With the help of the Boot-Strap-Loader (BSL) the program can also be reloaded via a serial interface.

The "DProbe430" tool offered by HiTex with its "DBox16" upgrade module is the only emulator for the MSP430 to date. It supports real-time debugging in assembler (from TI) and high-level language (with IAR C compiler), with a display of all processor resources. Only a few derivatives of the MSP430 series are supported.

overclocking

An involuntary admission by TI to overclocking shows the development tool eZ430: It contains an MSP430F169 as host computer for the USB bridge. According to the data sheet, this has a maximum clock frequency of 8 MHz. The crystal for this component is a 12 MHz type. TI is therefore launching its own product with an overclocking of 50%.

MSP432

On March 24, 2015, Texas Instruments introduced a new family with a 32-bit ARM Cortex-M4 CPU. Most peripheral elements - even if they have been technically newly developed or improved - from the developer's point of view are the same as in the MSP430, so that code porting from the MSP430 to the MSP432 can be implemented comparatively easily.

literature

  • Lutz Bierl: The great MSP430 practice book . Franzis, Munich 2004, ISBN 978-3-7723-4299-8 .
  • John H. Davies: MSP430 Microcontroller Basics . 1st edition. Newnes, 2008, ISBN 978-0-7506-8276-3 .
  • Marian Walter, Stefan Tappertzhofen: The MSP430 microcontroller book . 1st edition. Elektor, 2011, ISBN 978-3-89576-236-9 .
  • Matthias Sturm: Microcontroller technology . 2nd Edition. Carl Hanser Verlag, Munich 2011, ISBN 978-3-446-42231-5 .

Individual evidence

  1. Overview of the FRAM technology MSP430 website
  2. Application Note - Features of the MSP430 Bootstrap Loader
  3. slau176d page 9 (PDF; 283 kB)
  4. Frank Riemenschneider : TIs MSP432 microcontroller with ARM Cortex-M4. Article at Elektroniknet.de from March 24, 2015.

Web links

Commons : MSP430  - Collection of Images, Videos and Audio Files