stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection erro

  • 刚上手stm8,我好不容易用IAR编译成功了的一个工程
  • stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection erro
  • 就出现了这样的警告:
  • 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 
     
  • stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection erro
  • 大概意思就是未能初始化与硬件的通信
  • ST-linkV2是一款可以在线仿真+下载STM8的开发工具,stm8系列单片机通过SWIM接口与stlinkv2连接
  • 经资料查询正版ST-link/V2引脚定义和注意事项 SWIM-stm8接口的定义如下
  • stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection erro
  • 接线方向:接口有个槽,对准stlinkv2上的一个横片,接到stm8 J3 (8孔)模块,此时占去四孔
  • 继续检查发现我没有给板子供电
  • J3模块剩余四孔------------------跳线---------------电平转换模块-----------电脑USB口
  • 检查是否安装stlink的驱动上官网下了stm8-stlinkV2的驱动,安装。
  • 打开设管理器的通用穿行总线设备,有stlink即可
  • 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 erro

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 erro

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 erro

 

  • 此时如果载程序还是报错,说明还没有连接上,检查t跳线是否存在接触不良现象,
  • 我的就是接触不良,捣鼓一下,即可下载成功!界面应该是这样的。
  • stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection erro
  • 如果不用IAR,而是用STVP来下载程序
  • 先上官网下载STVPSTM8-STVP开发软件
  • stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection erro
  • 用IAR生成.s19文件,以为后续的工作做准备。打开IAR并打开已有工程 -->单击工程头选择Options --> 选择Output Converter --> 选择Generate additional output --> 选择output format中的Motorola选项 --> 选择override default -->将输出文件的后缀名改为.s19 -->重新编译整个工程 -->.s19在Debug\Exe目录下
  • stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection erro
  • 我发现IAR还是报错,把debuger的驱动换成了simulator
  • stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection erro
  • 编译、保存.s19文件
  • 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 erro
  • 打开ST Visual Programmer(STVP)并设置硬件连接方式和MCU型号,这里以ST-Link连接STM8LxG6系列为例
  • stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection erro
  • 打开led.s19文件
  • 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 erro
  • 文件成功导入
  •  
  •  
  •  
  •  
  •  
  • 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 erro

stm8烧录失败Failed to initialize communcation with hardware: SWIM error [30200]: ST-Link connection erro

成功