Application Report SLAA535A – August 2012 LaunchPad-Based MSP430 UART BSL Interface Leo Hendrawan................................................................................................................................ ABSTRACT This application report describes the implementation of the low-cost LaunchPad™-based MSP430 universal asynchronous receiver/transmitter (UART) bootstrap loader (BSL) interface. The goal of the implementation is to deploy the MSP430 Value Line devices that have less than two serial interface modules as the bridge between the BSL Scripter software tool and the MSP430 target device. Project collateral and source code associated with this application report can be downloaded from the following URL: http://www.ti.com/lit/zip/slaa535. Contents 1 Introduction .................................................................................................................. 2 Implementation .............................................................................................................. 3 References ................................................................................................................... Appendix A List of Tested Devices ............................................................................................. 1 3 5 6 List of Figures ........................................................... 1 BSL Entry Sequence for Devices With Shared JTAG Pins 2 BSL Entry Sequence for Devices With Dedicated JTAG Pins ........................................................ 2 2 3 UART Frame................................................................................................................. 2 4 Test Setup of Launchpad UART BSL Interface - MSP430F2274 on MSP-TS430DA38 .......................... 3 5 Hardware Connection of Launchpad-Based BSL Interface and MSP430 Target .................................. 4 List of Tables 1 MSP430G2231 Pin Assignments ......................................................................................... 3 2 List of Tested Devices ...................................................................................................... 6 1 Introduction 1.1 MSP430 Bootstrap Loader (BSL) The MSP430 BSL is a program that is built into the MSP430 devices for reading and modifying the MSP430 memory content, which can be used for firmware update purposes. Most MSP430 devices are delivered with UART BSL accessibility through the UART interface. The exception is for MSP430 devices with USB interfaces that have a built-in USB BSL. More detailed information regarding the MSP430 BSL can be found in the following wiki: BSL (MSP430). 1.1.1 UART BSL The UART BSL can be invoked by applying a specific BSL entry sequence signaling at RST and TEST (for devices with shared JTAG pins) and TCK (for device with dedicated JTAG pins). The BSL entry sequence is different between MSP430 devices that have shared JTAG pins and the ones with dedicated JTAG pins. The differences of the BSL entry sequences for both device types can be seen in Figure 1 and Figure 2. LaunchPad is a trademark of Texas Instruments. All other trademarks are the property of their respective owners. SLAA535A – August 2012 Submit Documentation Feedback LaunchPad-Based MSP430 UART BSL Interface Copyright © 2012, Texas Instruments Incorporated 1 Introduction www.ti.com RST TEST Figure 1. BSL Entry Sequence for Devices With Shared JTAG Pins RST TCK Figure 2. BSL Entry Sequence for Devices With Dedicated JTAG Pins The protocol data frame of the UART BSL is basically different between the ROM-based BSL and the Flash-based BSL. The ROM-based BSL is available on the 1xx, 2xx, and 4xx devices, while the Flashbased BSL can be found in the 5xx and 6xx devices. For more information regarding the BSL protocol on both BSL types, see the MSP430 Programming Via the Bootstrap Loader User's Guide (SLAU319). 1.2 Universal Asynchronous Receiver/Transmitter (UART) The universal asynchronous receiver/transmitter (UART) is a standard for serial communication, which is commonly deployed in embedded systems. Because the data is transferred serially and asynchronously (without any clock signal), both the transmitter and receiver sides have to use the same setting for data transfer speed (usually defined as baud rate), number of data bits, and usage of parity bit. The basic UART frame is shown in Figure 3. START Data Bit 0 Data Bit 1 ............... Data Bit N Parity bit (Optional) STOP Figure 3. UART Frame By default, the UART line is idle at logical high level. The START bit signal is basically marked as a transition of the first logical change from high level to low level. After the START bit, the data bits are transferred. In most systems, the data is sent in little-endian format (LSB first), and the data bits can usually be adjusted as 7 or 8 data bits. Before the STOP bit, an optional parity bit can be sent, if necessary, for frame checking. Finally, the STOP bit signal marks the end of a UART frame by a transition from logical low level to high level. 1.3 MSP-EXP430G2 Launchpad Experimenter Kit The MSP-EXP430G2 development kit, commonly known as Launchpad, is a low-cost experimenter kit for the MSP430G2xxx Value Line devices. The experimenter kit has an on-board emulator with a USB interface that can also be used as a UART (COM PORT) interface with 9600 baud rate. More detailed information regarding the Launchpad experimenter kit can be found in the following wiki: MSP430 LaunchPad (MSP-EXP430G2). 2 LaunchPad-Based MSP430 UART BSL Interface Copyright © 2012, Texas Instruments Incorporated SLAA535A – August 2012 Submit Documentation Feedback Implementation www.ti.com 2 Implementation This application report uses the MSP430G2231 device that is delivered together with the MSP-EXP430G2 Launchpad development kit. Because the difference of parity support between the MSP430-EXP430G2 Launchpad UART (9600 baud, no parity) and the specification of the MSP430 UART BSL (9600 baud, even parity), the MSP430G2231 checks the incoming byte from the PC and adds the even parity, if necessary, to the MSP430 target device. The Launchpad BSL Interface has been tested with several devices from the 1xx, 2xx, 4xx, and 5xx family on TI development kits. Figure 4 shows an example the test setup between the Launchpad and MSP430F2274 on the MSPTS430DA38 development board. For the complete list of tested devices, see Appendix A. Figure 4. Test Setup of Launchpad UART BSL Interface - MSP430F2274 on MSP-TS430DA38 2.1 Hardware Connection The implementation of the MSP430 Launchpad MSP430 UART BSL interface requires all pins of the MSP430G2231’s Port 1 (P1). The BSL Scripter originally used the DTR and RTS pins to generate the BSL entry sequence on the MSP430 target device. However, these pins are not available on the UART connection of the MSP-EXP430G2 Launchpad experimenter kit. Therefore, it is necessary to use the onboard S2 push button as the alternative input to make the MSP430G2231 on the Launchpad generate the BSL entry sequence to the MSP430 target device. Table 1 shows a list of the MSP430G2231 generalpurpose input/output (GPIO) pin assignments. Table 1. MSP430G2231 Pin Assignments GPIO Pin Description P1.0 TCK pin connection to MSP430 target with dedicated JTAG pins for generating BSL entry sequence P1.1 UART transmit pin to PC (connected to PC’s UART RX pin) P1.2 UART receive pin from PC (connected to PC’s UART TX pin) P1.3 Push button input to generate BSL entry sequence. P1.4 RST pin connection to MSP430 target for generating BSL entry sequence P1.5 TEST pin connection to MSP430 target with shared JTAG pins for generating BSL entry sequence P1.6 UART receive pin from MSP430 target (connected to MSP430 target BSL TX pin) P1.7 UART transmit pin to MSP430 target (connected to MSP430 target BSL RX pin) SLAA535A – August 2012 Submit Documentation Feedback LaunchPad-Based MSP430 UART BSL Interface Copyright © 2012, Texas Instruments Incorporated 3 Implementation www.ti.com Figure 5 shows an example of the hardware connection between the PC running the BSL Scripter and the BSLDEMO2 software, the MSP-EXP430G2 Launchpad and the MSP430 target device. (A) UART over USB (1) PC Running BSL Scripter and BSLDEMO2 P1.6 BSL TX P1.7 BSL RX P1.4 /RST (2) P1.5(B) (2) TEST(B) (3) P1.0(C) TCK(C) MSP-EXP430G2 MSP-EXP430G2 Launchpad Launchpad A MSP430 MSP430Target Target J3 jumpers should be connected on Launchpad. B For devices with shared JTAG pins. C For devices with dedicated JTAG pins. Figure 5. Hardware Connection of Launchpad-Based BSL Interface and MSP430 Target 2.2 Using the Launchpad MSP430 BSL Interface The procedure for using the Launchpad as MSP430 UART BSL interface is described as follows: 1. Compile the Launchpad BSL interface code that is provided in the associated zip file of this application report. Also provided with this document are the CCSTUDIO (Code Composer Studio) and the IAR project files along with the source code that can be opened using the free, code size limited version of CCSTUDIO (http://www.ti.com/tool/ccstudio) and IAR-Kickstart (http://www.ti.com/tool/iar-kickstart) IDE. When using Code Composer Studio and trying to import the CCSTUDIO project, do not to click the Copy projects into workspace check button. The source code is statically linked into the Code Composer Studio project and will not be copied when trying to copy the Code Composer Studio project into another workspace directory. This will make the compilation fail. 2. Flash the compiled firmware into the MSP430G2231. The associated zip file provided with this application report also contains the compiled TI-TXT or Intel-HEX binary files, which can be used together with the MSP430 Flasher (http://processors.wiki.ti.com/index.php/MSP430_Flasher__Command_Line_Programmer). 3. Disconnect the USB connection on the Launchpad and connect the Launchpad with the MSP430 target device as described in Section 2.1. Also, make sure that all J3 and J5 jumpers in the Launchpad are connected. It is possible to source the MSP430 target board directly from the Launchpad (for example, from the J6 connectors). However, if the MSP430 target is powered independently it is important to note that the signal level delivered by the MSP430G2231 on the Launchpad should not exceed the specified "Voltage applied to any pin" parameters defined in the device-specific data sheet of the MSP430 target device. 4 LaunchPad-Based MSP430 UART BSL Interface Copyright © 2012, Texas Instruments Incorporated SLAA535A – August 2012 Submit Documentation Feedback References www.ti.com 4. Reconnect the USB connection so that Launchpad is powered again. After about one second, the MSP430G2231 on the Launchpad automatically generates the BSL entry sequence. If the target BSL is successfully invoked, both red and green LEDs on the Launchpad should turn on. The red LED indicates that the MSP430G2231 is pulling the TCK pin up, while the green LED indicates that the target BSL pulls up its UART TX pin to high, idle state. If the BSL invocation fails, the red and green LEDs will blink continuously in an alternating pattern. The MSP430G2231 on Launchpad can only generate the BSL Entry Sequence once at the beginning after reset. Therefore, in order to regenerate the BSL Entry sequence, it is necessary to reset the MSP430G2231 on the Launchpad by pushing the S1 reset button. 5. As mentioned before, the MSP430G2231 on the Launchpad, by default, adds parity bit to every byte sent by the PC to the MSP430 target. If in specific cases, such as for the BSL of MSP430F54xx (nonA) family devices that do not expect a parity bit, the parity bit adding can be disabled by pressing the S2 button on the Launchpad during startup. This is indicated by one blink of the red LED, which confirms the input and disables the parity bit adding. 6. Run the BSL_Scripter or the BSLDEMO2 program to communicate with the BSL. The BSL_Scripter or the BSLDEMO2 should be executed with the correct serial COM PORT, which is assigned to the Launchpad by the PC. The COM PORT is called "MSP430 Application UART". 3 References • • • BSL (MSP430) wiki: BSL (MSP430) wiki MSP430 Programming Via the Bootstrap Loader User's Guide (SLAU319) MSP430x5xx/MSP430x6xx Family User's Guide (SLAU208) SLAA535A – August 2012 Submit Documentation Feedback LaunchPad-Based MSP430 UART BSL Interface Copyright © 2012, Texas Instruments Incorporated 5 www.ti.com Appendix A List of Tested Devices Table 2. List of Tested Devices Device 6 Silicon Revision Target Board CC430F6137 Rev E EM430F6137RF900 Connection (Launchpad – Target Board) J6.1 (VCC) - CON11.2 (VCC) J6.3 (GND) - CON11.9 (GND) J2.14 (P1.6) - CON10.1 (BSLTX) J2.15 (P1.7) - CON10.3 (BSLRX) J1.6 (P1.4) - CON10.4 (/RST) J1.7 (P1.5) - CON10.7 (TEST) MSP430F5172 Rev C MSP-TS430RSB40 J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) - J5.3 (GND) J2.14 (P1.6) - J4.36 (P3.7) J2.15 (P1.7) – J4.35 (P3.6) J1.6 (P1.4) - J4.33 (/RST) J1.7 (P1.5) - J4.32 (TEST) MSP430F5342 Rev F MSP-TS430RGZ48B J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) - J5.3 (GND) J2.14 (P1.6) - J2.14 (P1.1) J2.15 (P1.7) – J2.15 (P1.2) J1.6 (P1.4) - J4.46 (/RST) J1.7 (P1.5) - J4.41 (TEST) MSP430F5438 Rev L MSP-TS430PZ5x100 J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) - J5.3 (GND) J2.14 (P1.6) - J1.18 (P1.1) J2.15 (P1.7) - J1.19 (P1.2) J1.6 (P1.4) - J4.96 (/RST) J1.7 (P1.5) - J4.91 (TEST) MSP430F5438A Rev E MSP-TS430PZ5x100 J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) - J5.3 (GND) J2.14 (P1.6) - J1.18 (P1.1) J2.15 (P1.7) – J1.19 (P1.2) J1.6 (P1.4) - J4.96 (/RST) J1.7 (P1.5) - J4.91 (TEST) MSP430F149 Rev S MSP-TS430PM64 J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) - J5.3 (GND) J2.14 (P1.6) - J1.13 (P1.1) J2.15 (P1.7) - J2.22 (P2.2) J1.6 (P1.4) - J4.58 (/RST) J1.2 (P1.0) - J4.57 (TCK) MSP430F249 Rev D MSP-TS430PM64 J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) - J5.3 (GND) J2.14 (P1.6) - J1.13 (P1.1) J2.15 (P1.7) - J2.22 (P2.2) J1.6 (P1.4) - J4.58 (/RST) J1.2 (P1.0) - J4.57 (TCK) MSP430F1612 Rev B MSP-TS430PM64 J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) - J5.3 (GND) J2.14 (P1.6) - J1.13 (P1.1) J2.15 (P1.7) - J2.22 (P2.2) J1.6 (P1.4) - J4.58 (/RST) J1.2 (P1.0) - J4.57 (TCK) MSP430F1232 Rev F MSP-TS430PW28 J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) - J5.3 (GND) J2.14 (P1.6) - J2.22 (P1.1) J2.15 (P1.7) – J1.10 (P2.2) J1.6 (P1.4) – J1.7 (/RST) J1.7 (P1.5) – J1.1 (TEST) MSP430F2274 Rev E MSP-TS430DA38 J6.1 (VCC) - J3.1 (VCC) J6.3 (GND) – J3.3 (GND) J2.14 (P1.6) - J2.32 (P1.1) J2.15 (P1.7) – J1.10 (P2.2) J1.6 (P1.4) – J1.7 (/RST) J1.7 (P1.5) – J1.1 (TEST) LaunchPad-Based MSP430 UART BSL Interface Copyright © 2012, Texas Instruments Incorporated SLAA535A – August 2012 Submit Documentation Feedback Appendix A www.ti.com Table 2. List of Tested Devices (continued) Device Silicon Revision Target Board MSP430F2619 Rev E MSP-TS430PN80 J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) – J5.3 (GND) J2.14 (P1.6) - J1.13 (P1.1) J2.15 (P1.7) – J2.22 (P2.2) J1.6 (P1.4) – J4.74 (/RST) J1.2 (P1.0) – J4.73 (TCK) MSP430G2553 Rev A MSP-EXP430G2 J6.1 (VCC) - J6.1 (VCC) J6.3 (GND) – J6.3 (GND) J2.14 (P1.6) - J1.3 (P1.1) J2.15 (P1.7) – J1.7 (P1.5) J1.6 (P1.4) – J2.16 (/RST) J1.7 (P1.5) – J2.17 (TEST) MSP430F449 Rev G MSP-TS430PZ100 J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) – J5.3 (GND) J2.14 (P1.6) - J4.87 (P1.1) J2.15 (P1.7) – J4.86 (P1.5) J1.6 (P1.4) – J4.94 (/RST) J1.2 (P1.0) – J4.93 (TCK) MSP430FG4619 Rev F MSP-TS430PZ100 J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) – J5.3 (GND) J2.14 (P1.6) - J4.87 (P1.0) J2.15 (P1.7) – J4.86 (P1.1) J1.6 (P1.4) – J4.94 (/RST) J1.2 (P1.0) – J4.93 (TCK) MSP430F47187 Rev A MSP-TS430PZ100A J6.1 (VCC) - J5.1 (VCC) J6.3 (GND) – J5.3 (GND) J2.14 (P1.6) - J4.91 (P1.0) J2.15 (P1.7) – J4.90 (P1.1) J1.6 (P1.4) – J4.100 (/RST) J1.2 (P1.0) – J4.99 (TCK) MSP430FR5739 Rev D MSP-EXP430FR5739 J6.1 (VCC) - J6.1 (VCC) J6.3 (GND) – J6.3 (GND) J2.14 (P1.6) - SV2.11 (P2.0) J2.15 (P1.7) – SV2.8 (P2.1) J1.6 (P1.4) – J3.7 (/RST) J1.7 (P1.5) – J3.9 (TEST) SLAA535A – August 2012 Submit Documentation Feedback Connection (Launchpad – Target Board) LaunchPad-Based MSP430 UART BSL Interface Copyright © 2012, Texas Instruments Incorporated 7 IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, enhancements, improvements and other changes to its semiconductor products and services per JESD46C and to discontinue any product or service per JESD48B. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All semiconductor products (also referred to herein as “components”) are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TI’s terms and conditions of sale of semiconductor products. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarily performed. TI assumes no liability for applications assistance or the design of Buyers’ products. Buyers are responsible for their products and applications using TI components. To minimize the risks associated with Buyers’ products and applications, Buyers should provide adequate design and operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right relating to any combination, machine, or process in which TI components or services are used. Information published by TI regarding third-party products or services does not constitute a license to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. Reproduction of significant portions of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional restrictions. Resale of TI components or services with statements different from or beyond the parameters stated by TI for that component or service voids all express and any implied warranties for the associated TI component or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements concerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or support that may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards which anticipate dangerous consequences of failures, monitor failures and their consequences, lessen the likelihood of failures that might cause harm and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the use of any TI components in safety-critical applications. In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TI’s goal is to help enable customers to design and create their own end-product solutions that meet applicable functional safety standards and requirements. Nonetheless, such components are subject to these terms. No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the parties have executed a special agreement specifically governing such use. Only those TI components which TI has specifically designated as military grade or “enhanced plastic” are designed and intended for use in military/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI components which have not been so designated is solely at the Buyer's risk, and that Buyer is solely responsible for compliance with all legal and regulatory requirements in connection with such use. TI has specifically designated certain components which meet ISO/TS16949 requirements, mainly for automotive use. Components which have not been so designated are neither designed nor intended for automotive use; and TI will not be responsible for any failure of such components to meet such requirements. Products Applications Audio www.ti.com/audio Automotive and Transportation www.ti.com/automotive Amplifiers amplifier.ti.com Communications and Telecom www.ti.com/communications Data Converters dataconverter.ti.com Computers and Peripherals www.ti.com/computers DLP® Products www.dlp.com Consumer Electronics www.ti.com/consumer-apps DSP dsp.ti.com Energy and Lighting www.ti.com/energy Clocks and Timers www.ti.com/clocks Industrial www.ti.com/industrial Interface interface.ti.com Medical www.ti.com/medical Logic logic.ti.com Security www.ti.com/security Power Mgmt power.ti.com Space, Avionics and Defense www.ti.com/space-avionics-defense Microcontrollers microcontroller.ti.com Video and Imaging www.ti.com/video RFID www.ti-rfid.com OMAP Mobile Processors www.ti.com/omap TI E2E Community e2e.ti.com Wireless Connectivity www.ti.com/wirelessconnectivity Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2012, Texas Instruments Incorporated