---
# System prepended metadata

title: MSP430 For CCS 使用紀錄
tags: [TSC, MSP430]

---

###### tags: `TSC` `MSP430`

MSP430 For CCS 使用紀錄
===

## 安裝

- 下載CCS (Code Composer Studio)
https://software-dl.ti.com/ccs/esd/CCSv10/CCS_10_4_0/exports/CCS10.4.0.00006_win64.zip

- 安裝 (選擇 MSP430)
![](https://i.imgur.com/jXFTKqw.png)


## 建立專案

![](https://i.imgur.com/u1Jl4jK.png)
- (1) 選擇 Target 的 MCU
- (2) 測試是否可以使用 JATG 與 Target 連線 (若無連線請忽略)
- (3) 輸入專案名稱
- (4) 選擇空白專案 (使用已存在的source code)
- (5) 按下finish 完成建立


## 加入 Source code

- 複製 Source code 至專案目錄
![](https://i.imgur.com/K11UG0U.png)

- 點右鍵 Build code
![](https://i.imgur.com/OQlOyWw.png)


- 由於 header file 與 c code 放不同目錄，所以 build會有錯誤，==需加上include Path==
![](https://i.imgur.com/IveVZ6q.png)

- 專案目錄點右鍵 -> Properties -> include Options

:pick: Add application header file
```
${workspace_loc:/${ProjName}/src/application/h}
```
![](https://i.imgur.com/cCJRnV8.png)

 
:pick: Add driver header file
```
${workspace_loc:/${ProjName}/src/driver/h}
```
![](https://i.imgur.com/SOrAw0b.png)

## 設定 Build output 檔案格式 (use TI-TXT Hex )
- `專案目錄點右鍵 -> Properties -> MSP430 Hex Utility -> Enable 'MSP430 Hex Utility'`
![](https://i.imgur.com/iafNkam.png)

- `MSP430 MSP430 Hex Utility -> Output Format Options -> Output Format -> TI-TXT hex(--ti_txt)`
![](https://i.imgur.com/yl7TDGh.png)


:::danger
注意事項
:notebook:  由於 CCS Debug Mode 與 Release mode 專案設定分開，若有切換模式，需要在新的build模式(Debug/Release)下重新設定。
:::

## 重新編譯

若無錯誤將輸出以下資訊:

![](https://i.imgur.com/emxbuGa.png)

:::info
請注意是否有輸出 .txt 的訊息
:::

## 燒錄

### 硬體連接方式

MSP430FR2153 Socket board -> JTAG
![](https://i.imgur.com/SqteuIT.jpg)


### 產生燒錄檔
MSP430Flasher 有支援兩種格式
- [TI-TXT](https://downloads.ti.com/docs/esd/SPRUI03C/ti-txt-hex-format-ti-txt-option-stdz0795656.html)
- [Intel_HEX](https://en.wikipedia.org/wiki/Intel_HEX)
 
![](https://i.imgur.com/U3qIdCA.png)


## Resource

- Resource
https://dev.ti.com/tirex/explore/node?node=ANuFgo7aUNguwewu0GMeWg__IOGqZri__LATEST

- MSPDRIVERLIB
https://www.ti.com/tool/MSPDRIVERLIB#downloads

- MSP430Ware

- msp430-examples
https://github.com/ticepd/msp430-examples.git

- MSP430F5529小记(01): MSP430Ware使用及时钟配置
https://www.emoe.xyz/archives/515


## 開啟Git 

![](https://i.imgur.com/dGmZV2i.png)


### 使用 MSP430Flasher

- 下載
https://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430Flasher/1_03_20_00/exports/MSPFlasher-1_03_20_00-windows-installer.zip
- Step1. 將產出的 Hex binary file 複製至 MSP430Flasher 安裝目錄

- Step2. 新增燒錄及讀取目標版批次檔至安裝目錄

Example:

 
1. 燒錄 (更改你的 firmware 檔名 (firmware.txt))
```bat
CLS
REM 燒錄
MSP430Flasher.exe -w "firmware.txt" -v -g -z [VCC] 
pause
```

2. 讀取 MSP430 內的 firmware 檔案，並存至 FirmwareOutput.txt

```bat
CLS
MSP430Flasher.exe -r [FirmwareOutput.txt,MAIN]
pause
```

* Step3. 存檔 .bat 後，進行執行.bat 進行燒錄



## 注意事項


需要 Disable the GPIO power-on default high-impedance mode
```
PM5CTL0 &= ~LOCKLPM5;           // Disable the GPIO power-on default high-impedance mode
```

![](https://i.imgur.com/GNhWqCq.png)



Reference:

* [MSP Flasher user's guide (Rev. E)](https://www.ti.com/lit/pdf/SLAU654E)
* [Getting Started with MSP430 using Code Composer Studio-Blinking an LED](https://circuitdigest.com/microcontroller-projects/getting-started-with-msp430-using-code-composer-studio)
* [Getting Started with MSP430G2 using Energia IDE –Blinking an LED](https://circuitdigest.com/microcontroller-projects/getting-started-with-msp430G2-using-energia-ide-blinking-an-led)
* [CCSTUDIO](https://www.ti.com/tool/CCSTUDIO)
* [CCSTUDIO Users Guide](http://software-dl.ti.com/ccs/esd/documents/users_guide/index.html)
* [MSP430FR2153 hardware  development](https://www.ti.com/product/MSP430FR2153?qgpn=msp430fr2153#hardware-development)

* [CCS/MSP430F1121: Generating TI.TXT file with MSP430-GCC in CCSv8](https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/699580/ccs-msp430f1121-generating-ti-txt-file-with-msp430-gcc-in-ccsv8)

* [IAR-KICKSTART](https://www.ti.com/tool/IAR-KICKSTART#downloads)


* [COFF ABI vs EABI_snmplink](https://www.cxyzjd.com/article/qingwufeiyang12346/47634897)

* [生成和加载MSP430二进制文件](https://e2echina.ti.com/support/microcontrollers/msp430/f/msp-low-power-microcontroller-forum/190026/faq-msp430?tisearch=e2e-sitesearch&keymatch=faq%3Atrue)



https://www.ti.com/product/MSP430FR2153

* SPI
https://magicjackting.pixnet.net/blog/post/164725144




##  linux


```
sudo apt install libc6:i386 libusb-0.1-4 libgconf-2-4 build-essential


wget https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-J1VdearkvK/10.4.0.00006/CCS10.4.0.00006_linux-x64.tar.gz

tar -xvf CCS10.4.0.00006_linux-x64.tar.gz 

```

![](https://i.imgur.com/kabefZT.png)



![](https://i.imgur.com/hd61N4B.png)


![](https://i.imgur.com/09MW95V.png)


![](https://i.imgur.com/H1u8VUr.png)





