# GAC-300/350 MCU 固件烧写 ## 工具软件 ### ST-Link USB烧写工具 [官方产品介绍页面](http://www.st.com/content/st_com/zh/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-link004.html) > **提示**:所有固件工具都提供官方在线连接,实在找不到就找我(李洁)要。 ### 驱动安装 初次使用ST-Link需要安装驱动, 如果已经安装过Keil或者STM32CubeProgrammer 会自动安装驱动。打开设备设备管理器(Win+R 键入devmgmt.msc)确定。 ![](http://www.leconiot.com/md_res/jaysnote/st_link_program/images/st_link_device.png) 如果显示未知设备,需要手动安装驱动。驱动路径在`C:\Keil_v5\ARM\STLink\USBDriver` `C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\Drivers\stsw-link009_v3`。 ![未安装驱动](http://www.leconiot.com/md_res/jaysnote/st_link_program/images/st_unkown_device.png) > **提示**:以上驱动路径均为默认安装路径。需要先安装`STM32CubeProgrammer` 或者`Keil`。 ### 硬件连接 按照以下接口依次一一对应仿真器连接。 ![](http://www.leconiot.com/md_res/jaysnote/st_link_program/images/swd.png) > **提示**:如果已经POE供电,`V33_stm32` 可以不连接。 ## Flash 烧写工具 STM32CubeProgrammer 直接在ST 官网下载 [Flash 烧写工具 STM32CubeProgrammer](http://www.st.com/content/st_com/zh/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stm32cubeprog.html) 安装,需要[Java](https://java.com/zh_CN/download/) 环境,如果未安装,会自动跳转到下载页面提示安装。 * 双击打开软件,提示`Not connected` 点击 `Connect`(确认已经正常连接仿真器和IC) ![](http://www.leconiot.com/md_res/jaysnote/st_link_program/images/st_link_no_connected.png) 成功连接设备后提示`Conneceted`. ![](http://www.leconiot.com/md_res/jaysnote/st_link_program/images/st_link_connected.png) * 按照以下步骤依次点击,勾选。 1、选择 `Erasing &programming` 按钮; 2、点击`Browse ` 找到我们需要烧写的固件(通常为\* .bin、\*.hex、\*.axf); 3、勾选`Verify progrmming`(可选); 4、`Full chip erase`(全部擦出一次,可选); 5、`Start Programming ` (开始编程); 6、弹出和LOG提示成功; ![](http://www.leconiot.com/md_res/jaysnote/st_link_program/images/download_process.png) # Troubleshooting ### OLD ST-LINK fireware ![](http://www.leconiot.com/md_res/jaysnote/st_link_program/images/st_link_fireware_old.png) STM32CubeProgrammer 点击连接ST-Link提示固件太老,此时我们需要更新ST-Link 的固件。下载[ST-LINK, ST-LINK/V2, ST-LINK/V2-1 USB driver signed for Windows7, Windows8, Windows10](http://www.st.com/content/st_com/zh/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-utilities/stsw-link009.html) 双击打开后插入ST-Link,点击`Device Connect`后 点击`Yes >>>>` 直接升级。 ![](http://www.leconiot.com/md_res/jaysnote/st_link_program/images/st_link_fireware_update.png) ### No ST-Link device detected STM32CubeProgrammer 点击连接提示为检测到设备。 ``` No ST-Link device detected. Please connect it and then retry. ``` 检测 ST-LINK USB连接,设备管理器确定设备已经正常识别。 ### ST-LINK error (DEV_NO_DEVICE) STM32CubeProgrammer 点击 `Connect`提示未发现设备。检测SWD硬件连接。 ![](http://www.leconiot.com/md_res/jaysnote/st_link_program/images/st_link_no_device.png)