Sunteți pe pagina 1din 10

MSP430 Launch Pad

The MSP430 is a mixed-signal microcontroller family from Texas Instruments. Built around a 16-bit CPU, the MSP430 is designed for low cost, and specifically, low power consumption embedded applications. The architecture dates from the 1990s and is reminiscent of the DEC.

The MSP430 CPU uses a von Neumann architecture, with a single address space for instructions and data. Memory is byte-addressed, and pairs of bytes are combined little-endian to make 16bit words. The processor contains 16 16-bit registers, of which 4 are dedicated to special purposes: R0 is the program counter, R1 is the stack pointer, R2 is the status register, and R3 is a special register called the constant generator, providing access to 6 commonly used constant values without requiring an additional operand. R3 always reads as 0 and writes to it are ignored. R4 through R15 are available for general use. The instruction set is very simple; there are 27 instructions in three families. Most instructions are available in .B (8-bit byte) and .W (16-bit word) suffixed versions, depending on the value of a B/W bit: the bit is set to 1 for 8-bit and 0 for 16-bit. A missing suffix is equivalent to .W. Byte operations to memory affect only the addressed byte, while byte operations to registers clear the most significant byte. The MSP-EXP430G2 Launch Pad is an easy-to-use flash programmer and debugging tool that provides everything you need to start developing on MSP430 Value Line devices. It includes a 14-/20-pin DIP socketed target board with integrated emulation to quickly program and debug MSP430 Value Line devices in-system through the Spy Bi-Wire (2-wire JTAG) protocol. The flash memory can be erased and programmed in seconds with no external power supply required due to the MSP430's ultra-low power flash. The Launch Pad interfaces MSP430 devices to an integrated software environment such as Code Composer Studio Version 4 or IAR Embedded Workbench. These IDEs are free and unrestricted on MSP430 Value Line devices. The Launch Pad supports all MSP430G2xx flash parts in a 14 or 20 pin DIP package (TI package code: N). The Launch Pad also features on-board programmable LEDs and buttons for custom projects and applications! 10-pin PCB connectors are also provided for attaching additional devices to the Launch Pad. We like to use the MSP430 in simple low power designs, but the 4K and 8K size limits on the compiler can be annoying for bigger projects. Mspgcc is an open source compiler for the MSP430 without size limits, but its not a friendly alternative for the Arduino crowd

There are five general generations of MSP430 processors. In order of development, they were the '3xx generation, the '1xx generation, the '4xx generation, the '2xx generation, and the '5xx generation. The digit after the generation identifies the model (generally higher model numbers are larger and more capable), the third digit identifies the amount of memory on board, and the fourth, if present, identifies a minor model variant. The most common variation is a different on-chip analog-to-digital converter. The 3xx and 1xx generations were limited to a 16 bit address space. In the later generations this was expanded to include '430X' instructions that allow a 20 bit address space. As happened with the PDP-11, and as one might expect, extending the addressing range beyond the 16 bit word size introduced some peculiarities and inefficiencies for programs larger than 64 kBytes.

MSP430x1xx Series
The MSP430x1xx Series is the basic generation without an embedded LCD controller. They are generally smaller than the '3xx generation. These Flash or ROM based Ultra-Low Power MCUs offer 8 MIPS, 1.83.6 V operation, up to 60 KB Flash, and a wide range of high-performance analog and intelligent digital peripherals.

MSP430F2xx Series
The MSP430F2xx Series are similar to the '1xx generation, but operate at even lower power, support up to 16 MHz operation, and have a more accurate (2%) on-chip clock that makes it easier to operate without an external crystal. These Flash-based Ultra-Low Power offer 1.83.6 V operation. Includes the Very-Low power Oscillator (VLO), internal pull-up/pull-down resistors, and low-pin count options.

MSP430G2xx Series
The MSP430G2xx Value Series features flash-based Ultra-Low Power MCUs up to 16 MIPS with 1.83.6 V operation. Includes the Very-Low power Oscillator (VLO), internal pull-up/pull-down resistors, and low-pin count options, at lower prices than the MSP430F2xx series.

MSP430x3xx Series
The MSP430x3xx Series is the oldest generation, designed for portable instrumentation with an embedded LCD controller. This also includes a frequency-locked loop oscillator that can automatically synchronize to a low-speed (32 kHz) crystal. This generation does not support EEPROM memory, only mask ROM and UV-erasable and one-time programmable EPROM. Later generations provide only flash ROM and mask ROM options. These devices offer 2.55.5 V operation, up to 32 KB ROM.

MSP430x4xx Series
The MSP430x4xx Series are similar to the '3xx generation, and also include an integrated LCD controller, but are larger and more capable. These Flash or ROM based devices offers 8 16 MIPS at 1.83.6 V operation, with FLL, and SVS. Ideal for low power metering and medical applications.

MSP430x5xx Series
The MSP430x5xx Series are able to run up to 25 MHz, have up to 256 kB flash memory and up to 16 kB RAM. This new Flash-based family features the lowest active power consumption with up to 25 MIPS at 1.8-3.6 V operation (165 uA/MIPS). Includes an innovative Power Management Module for optimal power consumption. Many devices feature integrated USB.

MSP430X 20-bit extension


The basic MSP430 cannot support more memory (ROM + RAM + peripherals) than its 64K address space. In order to support this, an extended form of the MSP430 uses 20-bit registers and a 20-bit address space, allowing up to 1 MB of memory. This uses the same instruction set as the basic form, but with two extensions: 1. A limited number of 20-bit instructions for common operations, and 2. A general prefix-word mechanism that can extend any instruction to 20 bits. The extended instructions include some additional capabilities, notably multi-bit shifts and multi-register load/store operations. 20-bit operations use the length suffix ".A" (for address) instead of .B or .W. .W is still the default. In general, shorter operations clear the high-order bits of the destination register.

General-purpose I/O ports 010


As is standard on microcontrollers, most pins connect to a more specialized peripheral, but if that peripheral is not needed, the pin may be used for general-purpose I/O. The pins are divided into 8-bit groups called "ports", each of which is controlled by a number of 8-bit registers. In some cases, the ports are arranged in pairs which can be accessed as 16-bit registers. The MSP430 family defines 11 I/O ports, P0 through P10, although no chip implements more than 10 of them. P0 is only implemented on the '3xx family. P7 through P10 are only implemented on the largest members (and highest pin count versions) of the '4xx and '2xx families. The newest '5xx and '6xx families has P1 through P11, and the control registers are

reassigned to provide more port pairs. Each port is controlled by the following registers. Ports which do not implement particular features (such as interrupt on state change) do not implement the corresponding registers.

Intelligent Peripherals
Analog-to-Digital Converter The MSP430 line offers two types of Analog-to-Digital Conversion (ADC). 10- and 12-bit Successive Approximation converters, as well as a 16-bit Sigma-Delta converter. Data transfer controllers and a 16 word conversion-and-control buffer allow the MSP430 to convert and store samples without CPU intervention, minimizing power consumption. Brown Out Reset The Brown out Reset circuitry detects low supply voltages and initiates a POR (Power On Reset) signal to reset the device. The MSP430's BOR circuit uses almost no power and is enabled at all times, including in all low power modes. Comparator A, A+ The MSP430's comparator module provides precision slope Analog-to-Digital Conversions. Monitors external analog signals and provides voltage and resistor value measurement. Capable of selectable power modes. Digital-to-Analog Converter The MSP430's Digital-to-Analog Converter module features 8- and 12-bit modes and a programmable settling time for low power optimization. Internal or external reference selection is also possible. Timers The MSP 430 has 1 or 2 relatively flexible timers (5xxx series has 3). Each timer has 3 to 7 captures and compares registers that can each be observing the timer count and take a snap shot due to the change in an external signal or cause an external signal to change at a specified timer count. One of the timers can get its clock from an external signal. Timer clocks cannot be gated or started and stopped by external signals. The ability to chain timers together to produce complex pulse sequences is limited. Interrupt generation is very flexible.

Direct Memory Access Controller The MSP430's DMA allows data transfers from one address to another without CPU intervention, across the entire address range. Features up to three independent transfer channels. Although the MSP430's DMA subsystem is very capable it has several flaws, the most significant of which is the lack of an external transfer strobe. Although a DMA transfer can be triggered externally, there is no external indication of completion of a transfer. Consequently DMA to and from external sources is limited to external trigger per byte transfers, rather than full blocks automatically via DMA. This can lead to significant complexity (as in requiring extensive hand tweaking of code) when implementing processor to processor or processor to USB communications. The reference cited uses an obscure timer mode to generate high speed strobes for DMA transfers. Unfortunately, the timers are not flexible enough to easily make up for the lack of an external DMA transfer strobe. DMA operations that involve word transfers to byte locations cause truncation to 8 bits rather than conversion to two byte transfers. This makes DMA with A/D or D/A 16 bit values less useful than it could be (although it is possible to DMA these values through port A or B on some versions of the MSP 430 using an externally visible trigger per transfer such as a timer output). ESP430 (integrated in FE42xx devices) The ESP430CE module performs metering calculations independent of the CPU. Module has separate SD15, HW multiplier, and embedded processor engine. LCD/LCD_A/LCD_B The LCD/LCD_A controller directly drives LCD displays for up to 196 segments. Supports static, 2-mux, 3-mux, and 4-mux LCDs. LCD_A module has integrated charge pump for contrast control. LCD_B enables blinking of individual segments with separate blinking memory. Op Amps Feature single supply, low current operation with rail-to-rail outputs and programmable settling times. Software selectable configuration options: unity gain mode, comparator mode, inverting PGA, non-inverting PGA, differential and instrumentation amplifier. Hardware multiplier Some MSP430 models include a memory-mapped hardware multiplier peripheral which performs various 1616+3233-bit multiply-accumulate operations. Unusually for the MSP430, this peripheral does include an implicit 2-bit write-only register, which makes it effectively impossible to context switch.

Programming MSP430
How to program the newer MSP430 microcontrollers with the Launch Pad, such as the MSP430F55xx series. There are two ways to program an MSP430, the first is using four-wire JTAG, the second is using two-wire JTAG. The Launch Pad can only use the two-wire JTAG method, which is also known as Spy-BiWire (SBW). For the rest of this post, I will be referring to the two-wire JTAG as SBW and four-wire JTAG as just JTAG. I want to make sure this is clear before I continue; JTAG and SBW are two separate methods for programming an MSP430. The Launch Pad can program MSP430s using SBW, not JTAG. That being said, not all MSP430s can be programmed using SBW, some of the older MSP430s can only be programmed using JTAG. TI has a document, SLAU157, which shows which chips support either just JTAG or both JTAG and SBW. Now that we know JTAG and SBW are different methods of programming newer MSP430s, how do we use the Launch Pad to program all these cool devices? Spy-Bi-Wire needs two wires to program an MSP430: RST and TEST. The image below shows where you can find these two pins on the Launch pad.

The RST pin is shown by a yellow square, TEST is shown by a green square, and all of the GND pins are shown by blue squares. What about power? Well, you can either use the Launch Pad to power the DEV.BO (or your target MSP430 that supports SBW) or use an external power source. Regardless of how you power the target, you will need to also connect the Launch Pads GND pin to the target. This is because you need a common reference for the data pins (RST and TEST); so technically you actually need a minimum of three wires to program an MSP430.

We will use the Launch Pad to not only program the DEV.BO, but to also power it during programming. The image above shows which signals make up the programming header on the DEV.BO. There is a reason that I designed the programming header pins in that order. They are the same order as the Launch Pad, this is very important. What about the GND pin on the Launch Pad? Though there is no GND pin on the programming header, the Launch Pad does have a few GND pins available on board. Depending on what you have to connect the boards together, determines which GND you should choose.

The image above shows how I connect the DEV.BOs header to the Launch Pad. That nice six pin rainbow connector is available here at Spark Fun and it works great for this task. Notice how I am using female connectors on this Launch Pad which makes it easy for me to connect GND to the rainbow connector using just a short breadboard wire. If you don't have access to this nice rainbow ribbon cable, you can use any method to connect these pins together. Hopefully that should clear up any confusion on how to program the DEV.BO. Using this method, you can also program any other MSP430 that supports SBW; just connect up the necessary pins and you can program away. I have two last things I want to mention. The RXD and TXD pins are not needed for programming but I included them on the DEV.BO in case they are ever needed for a project. The second thing is that you need to make sure the correct chip is selected in CCS or whatever IDE you use when programming the MSP430, otherwise it probably won't work. I hope this clears up any confusion on how to program external MSP430s, including the DEV.BO, using the Launch Pad. Please leave a comment if you have any questions about this post. Don't forget to check out the DEV.BO, which is available in my online store.

Connecting
hopefully by now it is clear that from the hardware side of things only a UART connection is needed

between the Bluetooth module and your MSP430. What about from the other side of the data stream? the computer. Linking the module to the computer was surprisingly easy. On Windows 7 (I cant speak for any other OS or version of Windows), it was plug and play. Within a few seconds the drivers were automatically installed and I could see which COM port the module was connected to in the device manager.

The device manager showing the RN-42 connected as COM6. As I mentioned before, my terminal program of choice is Real term. The first test I recommend completing when setting up the module is a simple echo test. Connect the RX and TX pins on the module together, and then set the COM port to the correct port and the baud rate to 115200 baud in your terminal. Once everything is set up and the power is on, wait for the device to connect. If you have the status LEDs connected to the module (which are optional if you are worried about power consumption), the LED connected to PIO2 should turn on when the module is paired with the computer. The other status LED will blink if the device is not connected. Once connected, type a few characters in the terminal and you should receive back every character you typed into the terminal.

Note: If you are running off of a battery, which you probably are given that this is a post about Bluetooth, you will run into connection issues when the battery is getting low. The module will still turn on and the LEDs will still blink, but you will not be able to reliably connect. If you are having connection issues, check your battery.

That should be all that you need to know in order to add Bluetooth to your project. If you think there is something I have missed, let me know and I will add a section to this post.

Commands
Yes, this module can accept commands which allow the user to change some important settings. I will not be discussing these commands in this post. You can find all the information you need on this topic in the Roving Networks User Manual.

Baud Rate Trouble


As I mentioned earlier I want to discuss the problems I have with the data rate of this device. My frustrations really arise from false claims on the specifications of the device from both the manufacturer and vendors.

"Over air data rate of 721kbps to 2.0Mbps" - Spark Fun product page "Data Rate: 1200 bps to 921 Kbps" - Mouser "Sustained SPP data rates - 240Kbps (slave), 300Kbps (master)" and "HCI data rates - 1.5Mbps sustained, 3.0Mbps burst in HCI mode" - Roving Networks Datasheet for the RN-42

The quotes above show where my frustrations originate. To be honest, I am not really sure where Spark Fun got their numbers; if I am missing something, please point it out to me. To make things clear, this device really only functions in SPP mode, thus you have a max data rate of 240Kbps if the device is in slave mode. I'm not even sure if it's possible to put the device in HCI mode, apparently it must be done at the factory. So the datasheet is clear about the max speeds in each mode, but I am frustrated that they do not make it abundantly clear that the device cannot work in HCI mode. I emailed Roving Networks inquiring about this dilemma I was having (I wanted to use 921600 baud sustained over the air) and though they were friendly, prompt, and reasonably helpful, I was/am not happy with how misleading their datasheets are. The HCI mode is a special build of firmware the needs to be programmed at the factory. Please understand that in HCI mode, the Bluetooth stack is running on the external host processor and the module is acting as a radio. All in all, I do commend them on their customer service, just keep in mind that realistically speaking, you will only be able to use SPP mode.

Conclusions
Despite my frustrations, this is a great solution for making your project wireless. I have found very few chips or modules that can be integrated into a project with such ease. There are so many cool possibilities for projects when using Bluetooth, the possibilities are endless! Who wouldn't want to hook up a project to an Android phone?

S-ar putea să vă placă și