MSP430笔记-点灯
摘要
使用macOS以类似ArduinoIDE方式开发TI_LaunchPad_MSP_EXP430G2开发板,实现点灯.
平台信息
- macOS 13.5
- Energia 1.8.11E23(IDE)
- TEXAS INSTRUMENTS MSP-EXP430G2 LaunchPad
- LED_RED:P1.0
TEXAS INSTRUMENTS MSP-EXP430G2 LaunchPad
[https://www.ti.com.cn/tool/cn/MSP-EXP430G2ET#tech-docs]
- 一块开发板LaunchPad(Rev1.4)
- 一个mini USB连接线
- 2个预编了程序的MSP430G2xxx 系列芯片(MSP430G2211IN14,MSP430G2231IN14)
- 10脚的单排连接器(2个插针,2个插座)
- 一个32.768kHz 晶体振荡器 (MS3V-T1R 32.768kHz CL: 12.5pF +/-20ppm)
- 一张快速入门手册
- 2个LaunchPad的标签纸
TI已经将LaunchPad完全开源,你可以在网上下载硬件设计的详细信息(包括原理图、版图和BOM表)。前面我们可以知道LaunchPad有两部分组成包括仿真编程部分和MSP430G2xxx MCU的最小系统部分。
主控制器 MSP430F1612 MSP430系列微处理器,有两个UART接口,其中一路连接USB转串口控制器,另一路连接板上MSP430G2xxxx超值系列微处理器UART口。
USB控制器 TUSB3410 用于USB接口转RS232串口,支持全速(Fullspeed)USB2.0,内置了一个8052微控制器,板上还配了一个I2C接口的EEPROM(4Kb x 8 CAT24FC32).
电源部分,采用了TI的快速瞬态响应稳压器(LDO)TPS77301DGK ,最大能输出250mA电流,输出电压范围为1.5V~5.5V,同时在USB接口处采用了ESD防护阵列TPD2E001,提高静电防护。
仿真编程部分与MSP430G2xxx系统部分通过跳线相连,包括2线JTAG信号(TEST、RST),2线UART信号(RXD、TXD)以及电源VCC。
20脚DIP插座可以支持不同MCU,使得LaunchPad可以不断不升级支持新的MCU,所有20脚IO全部扩展。
板上的IO设备还包括2个可编程LED和一个可编程按钮以及复位按钮。LaunchPad上 还有一个备用电源引脚,电源是直接连到MCU芯片,使用要小心只能在1.8V和3.3V之间。如果想测量板上MSP430G2xxx芯片的功耗时,只要断 开VCC跳线,而将外部电源接入电源引脚。
Energia
[https://energia.nu/]
[https://github.com/energia/Energia]
Energia 是一个开源电子原型设计平台,由 Robert Wessels 于 2012 年 1 月创立,其目标是将 Wiring 和 Arduino 框架引入基于德州仪器 MSP430 的 LaunchPad。 Energia IDE 是跨平台的,支持 Mac OS、Windows 和 Linux。 Energia 使用 Peter Bigot 的 msp gcc 编译器。Energia 包括一个集成开发环境 (IDE),它以处理 IDE(处理→接线→Arduino→Energia)为基础。 Energia 也是一个可移植的框架/抽象层,可以在其他流行的 IDE 中使用。
Energia 和 Arduino 的基础是 Hernando Barragan 开发的 Wiring 框架。该框架是为设计师和艺术家精心创建的,旨在鼓励来自世界各地的初学者和专家分享想法、知识和集体经验的社区。Energia 团队采用边做边学的理念,努力让直接使用硬件变得容易。专业工程师、企业家、制造商和学生都可以从 Energia 为微控制器带来的易用性中受益。
德州仪器(Texas Instruments)提供了 MSP430、MSP432x、TM4C、C2000、CC32xx 和 CC13xx LaunchPad, LaunchPad 是由德州仪器 (TI) 制造的低成本微控制器板。最新版本的 Energia 支持大多数 LaunchPad 产品。
Energia release 23 (aka Energia 1.8.10E23) and up feature the new board (core) / library manager. By default the Energia installation comes with support for the MSP430. Other cores such as CC1310, CC13x2, CC3220, TivaC, CC3200 and MSP432 can be installed through the board manager by selection Tools →Board→Board Manager. For more details on how to install additional cores/boards see the board manager guide guide. The cores included in the board manager are: MSP430, MSP432 (MT, TI-RTOS based multitasking), CC3200 and TivaC. The CC3200 (MT) TI-RTOS based multitasking based core will be made available in the near future through the board manager. CC2650 has been removed from Energia due to the lack of BLE support that could not be enabled because of licensing issues with the BLE stack.
The Energia project is no longer maintained.
Energia, the fork of the Arduino IDE and SDK for the LaunchPad boards, is no longer maintained. The last release 1.8.10E23 was published in December 2019.
The official tools from Texas Instruments are Code Composer Studio, based on Eclipse with an online variant, and the SimpleLink SDK for the ARM Cortex-M MCUs.
Sketches are uploaded by DSLite, the same tool CCS Cloud uses to debug / upload from the cloud editor.
mspdebug
[https://github.com/dlbeer/mspdebug]
[https://hackaday.com/2010/08/11/how-to-launchpad-programming-with-linux/]
[http://dlbeer.co.nz/mspdebug/]
MSPDebug is a free debugger for use with MSP430 MCUs. It supports FET430UIF, eZ430, RF2500 and Olimex MSP430-JTAG-TINY programmers, as well as many other compatible devices. It can be used as a proxy for gdb or as an independent debugger with support for programming, disassembly and reverse engineering.
Features
Userspace only: no kernel modifications required.
Works with RF2500, eZ430, FET430UIF (V2 and V3), Launchpad, Chronos, GoodFET, Olimex MSP430-JTAG-TINY and MSP430-JTAG-ISO programmers. Also supports the TI flash bootloader.
Can act as a GDB remote stub (replacement for msp430-gdbproxy) and/or a GDB client.
Can single-step, program, run to breakpoint and inspect memory on supported devices.
Support for power profiling.
Can be used to access the FET430UIF bootloader.
Supports Intel HEX, ELF32, BSD symbol table, COFF, TI Text and SREC file formats.
Can disassemble code in memory, including translating addresses to symbols.
Includes reverse-engineering features such as instruction search, call-graph analysis and symbol table editing.
Simulation mode allows execution of MSP430 code without hardware.
Cross-platform: compiles on Linux, *BSD, OS/X and Windows.
The TUSB3410 on the launchpad (and also the EZ430-RF2500 and Chronos) does not contain a "normal" serial port of the sort that the TI-distributed VSP driver uses (and is used on the EZ430-F2013) It has custom software that implements a HID device for use bye spybiwire, and a CDC ACM serial port for the serial port (which is not done in a way that the Mac seems to like.)
rf2500: can't claim interface: Permission denied
MSPDebug version 0.24 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2016 Daniel Beer dlbeer@gmail.com
rf2500: failed to open RF2500 device
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Chip info database from MSP430.dll v3.3.1.4 Copyright (C) 2013 TI, Inc.
实现
[https://hackaday.com/2010/08/11/how-to-launchpad-programming-with-linux/]
代码
- 工具->开发板:MSP-EXP430G2 w/MSP430G2553
blink.ino
/*
Blink
The basic Energia example.
Turns on an LED on for one second, then off for one second, repeatedly.
Change the LED define to blink other LEDs.
Hardware Required:
* LaunchPad with an LED
This example code is in the public domain.
*/
// most launchpads have a red LED
#define LED RED_LED
//see pins_energia.h for more LED definitions
//#define LED GREEN_LED
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(LED, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
- 项目->导出已编译的二进制文件
烧录和编译
Energia自带的mspdebug无法正常工作,因而需要另外安装.
brew install mspdebug
mspdebug --version
mspdebug --help
mspdebug --usb-list
cd (blink工程目录)
#rf2500是一类usb协议控制器,这里就是指TUSB3410
#如果没有识别到就重新插拔usb
(sudo) mspdebug rf2500
prog blink.ino.MSP-EXP430G2553LP.hex
run
#Ctrl+C to interrupt
exit
mspdebug --usb-list
输出:
Devices on bus 000:
000:005 0451:f432 eZ430-RF2500 [serial: 9BFF5184AB8E122D]
000:004 25a4:9311 [serial: 000000000001]