stm8 烧录失败 Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection erro
![stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection - 图1](/uploads/projects/matelearn@olhy59/9ff7915e9560ebd5091ddf7d66f14b85.png)
luoyir1997 2018-07-24 15:22:35 ![stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection - 图2](/uploads/projects/matelearn@olhy59/972279f1636ff47dca28cb398f3a72f5.png)
12850 ![stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection - 图3](/uploads/projects/matelearn@olhy59/ab6f8828295f8c9af545e9984f2de551.png)
![stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection - 图4](/uploads/projects/matelearn@olhy59/1ab7e7809c148db33651499adfcb418e.png)
收藏  9
分类专栏: stm8#+stm32#+lora#+IAR
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/luoyir1997/article/details/81185414
版权
stm8#+stm32#+lora#+IAR
 专栏收录该内容
34 篇文章 1 订阅
订阅专栏
- 刚上手 stm8,我好不容易用 IAR 编译成功了的一个工程
 
 - 就出现了这样的警告:
 - Mon Jul 23, 2018 14:38:55: Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection error
 - Mon Jul 23, 2018 14:38:55: Failed to load debugee: E:\LoRa\stm8\project\Debug\Exe\led.out
 
 - 大概意思就是未能初始化与硬件的通信
 - ST-linkV2 是一款可以在线仿真 + 下载 STM8 的开发工具,stm8 系列单片机通过 SWIM 接口与 stlinkv2 连接
 - 经资料查询正版 ST-link/V2 引脚定义和注意事项 SWIM-stm8 接口的定义如下
 
 - 接线方向:接口有个槽,对准 stlinkv2 上的一个横片,接到 stm8 J3 (8 孔)模块,此时占去四孔
 - 继续检查发现我没有给板子供电
 - J3 模块剩余四孔 ————————— 跳线 ———————- 电平转换模块 —————- 电脑 USB 口
 - 检查是否安装 stlink 的驱动上官网下了 stm8-stlinkV2 的驱动,安装。
 - 打开设管理器的通用穿行总线设备,有 stlink 即可
 
 - 如果还不能连上,到官网下载驱动更新程序
 
 
![stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection - 图11](/uploads/projects/matelearn@olhy59/9ad22c1d5e810c092492eb8bca238e8b.png)
![stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection - 图12](/uploads/projects/matelearn@olhy59/7b6d97badbe64fac26ebd4b92dc73457.png)
![stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection - 图13](/uploads/projects/matelearn@olhy59/83ceb514b479ea0cd72b791a29873408.png)
再次打开设备管理器
![stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection - 图14](/uploads/projects/matelearn@olhy59/7c024e4d11fc7136d32372367fe5f023.png)
- 此时如果载程序还是报错,说明还没有连接上,检查 t 跳线是否存在接触不良现象,
 - 我的就是接触不良,捣鼓一下,即可下载成功!界面应该是这样的。
 
 - 如果不用 IAR,而是用 STVP 来下载程序
 - 先上官网下载 STVPSTM8-STVP 开发软件
 
 - 用 IAR 生成. s19 文件,以为后续的工作做准备。打开 IAR 并打开已有工程 —> 单击工程头选择 Options —> 选择 Output Converter —> 选择 Generate additional output —> 选择 output format 中的 Motorola 选项 —> 选择 override default —> 将输出文件的后缀名改为. s19 —> 重新编译整个工程 —>.s19 在 Debug\Exe 目录下
 
 - 我发现 IAR 还是报错,把 debuger 的驱动换成了 simulator
 
 - 编译、保存. s19 文件
 
 
 - 打开 ST Visual Programmer(STVP) 并设置硬件连接方式和 MCU 型号,这里以 ST-Link 连接 STM8LxG6 系列为例
 
 - 打开 led.s19 文件
 
 
 - 文件成功导入
 
 
![stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection - 图25](/uploads/projects/matelearn@olhy59/8a80e7b8e3d723e10157e7e12e48c4b1.png)
![stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection - 图26](/uploads/projects/matelearn@olhy59/f936d584c240473355a201e2137a5d94.png)
