最近一直在研究stm32f103VET6开发板

使用的野火CMSIS-DAP仿真器进行与指南者板子开发。

使用的是基于ubuntu openocd + vscode +makefile环境 进行烧写与程序仿真。
相比IDE也有很多优势,用熟了简单方便而且还快,还是免费环境,更主要是linux环境。

但最近发生两次这个Error: unable to find CMSIS-DAP device问题
进行了大量百度和谷歌,多次安装系统,最终定位了问题。

有很多介绍使用rules.d方案,没有效果!!!!

首先问题定位:

dji@dji-MANIFOLD-2-C:/home$ lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M|__ Port 3: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M|__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M|__ Port 3: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M|__ Port 1: Dev 11, If 0, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M|__ Port 2: Dev 6, If 1, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 2: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 1: Dev 5, If 2, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 1: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 1: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 4: Dev 7, If 0, Class=Vendor Specific Class, Driver=ch341, 12M

其中我们注意正常情况下cmsis-dap的驱动情况应该是

        |__ Port 1: Dev 11, If 0, Class=Human Interface Device, Driver=usbhid, 12M

驱动应该为Driver=usbhid,在ubuntu环境下才可以识别,进行仿真与烧写。

本人将cmsis-dap的白色连接线直接连接板卡swd口,不使用jtag口与板卡连接,我们发现以下情况:

dji@dji-MANIFOLD-2-C:/home$ lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M|__ Port 3: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M|__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M|__ Port 3: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M|__ Port 1: Dev 12, If 0, Class=Human Interface Device, Driver=usbfs, 12M|__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M|__ Port 2: Dev 6, If 1, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 2: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 1: Dev 5, If 2, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 1: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 1: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 4: Dev 7, If 0, Class=Vendor Specific Class, Driver=ch341, 12M

我们注意到驱动变为了

|__ Port 1: Dev 12, If 0, Class=Human Interface Device, Driver=usbfs, 12M

驱动变更为 Driver=usbfs
此时在vscode中,使用make语句进行烧写代码会遇到以下问题

Open On-Chip Debugger 0.9.0 (2018-01-24-01:05)
Licensed under GNU GPL v2
For bug reports, readhttp://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'swd'
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
cortex_m reset_config sysresetreq
Error: unable to find CMSIS-DAP deviceMakefile:158: recipe for target 'flash' failed
make: *** [flash] Error 1

解决思路

将驱动usbfs转为usbhid 就可以从新识别。

1.定位驱动符号

插拔cmsis-dap的usb线缆

dji@dji-MANIFOLD-2-C:/home$dmesg
[ 1479.177215] usb 1-3.1: USB disconnect, device number 12
[ 1522.653826] usb 1-3.1: new full-speed USB device number 13 using xhci_hcd
[ 1522.784037] usb 1-3.1: New USB device found, idVendor=0483, idProduct=5750
[ 1522.784044] usb 1-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1522.784048] usb 1-3.1: Product: CMSIS-DAP
[ 1522.784051] usb 1-3.1: Manufacturer: embedfire
[ 1522.784054] usb 1-3.1: SerialNumber: 13CFECDCE2E5
[ 1522.786883] hid-generic 0003:0483:5750.000D: hiddev3,hidraw5: USB HID v1.11 Device [embedfire CMSIS-DAP] on usb-0000:00:14.0-3.1/input0

定位标识符1-3.1,在usb连接着cmsis-dap时输入以下命令
在终端依次输入以下命令

sudo sh -c "echo 0 > /sys/bus/usb/devices/你的标识符/authorized"本人为例
sudo sh -c "echo 0 > /sys/bus/usb/devices/1-3.1/authorized"

然后再输入

sudo sh -c "echo 1 > /sys/bus/usb/devices/你的标识符/authorized"本人为例
sudo sh -c "echo 1 > /sys/bus/usb/devices/1-3.1/authorized"

问题得以解决

dji@dji-MANIFOLD-2-C:/home$ lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M|__ Port 3: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M|__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M|__ Port 3: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M|__ Port 1: Dev 14, If 0, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M|__ Port 2: Dev 6, If 1, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 2: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 1: Dev 5, If 2, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 1: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 1: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 4: Dev 7, If 0, Class=Vendor Specific Class, Driver=ch341, 12M

驱动恢复成usbhid

dji@dji-MANIFOLD-2-C:~/stm32/code/middle/19_system_tick$ make flash
openocd -f openocd.cfg -c init -c halt -c \
"flash write_image erase ./build/build_pro.elf" -c reset -c shutdown
Open On-Chip Debugger 0.9.0 (2018-01-24-01:05)
Licensed under GNU GPL v2
For bug reports, readhttp://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'swd'
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 2.0.0
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD IDCODE 0x1ba01477
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x41000000 pc: 0x080006b8 msp: 0x2000fff8
auto erase enabled
Info : device id = 0x10036414
Info : flash size = 512kbytes
wrote 4096 bytes from file ./build/build_pro.elf in 0.476039s (8.403 KiB/s)
target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000003a msp: 0x2000fff8
shutdown command invoked

系统可以完成烧写工作

cmsis-dap ubuntu Error: unable to find CMSIS-DAP device相关推荐

  1. ubuntu下android虚拟机(emulator)出现error: unable to load driver错误

    在Ubuntu环境下运行自带的android studio虚拟机时会报如下错误: error: unable to load driver: XXXXXX.so 解决方法是: mv ~/Documen ...

  2. ubuntu安装ROS进行到rosdep update时出现错误,如ERROR: unable to process source ...

    1.错误描述: ming@ming:~$ rosdep update reading in sources list data from /etc/ros/rosdep/sources.list.d ...

  3. 成功解决ERROR: Unable to find the development tool `make` in your path; please make sure that you have t

    成功解决ERROR: Unable to find the development tool `make` in your path; please make sure that you have t ...

  4. 成功解决ERROR: Unable to find the development tool `cc` in your path; please make sure that you have the

    成功解决ERROR: Unable to find the development tool `cc` in your path; please make sure that you have the ...

  5. ERROR: Rosdep experienced an error: Unable to handle package.xml format version ‘3‘

    errror catkin_make 命令时候,报错如下: ERROR: Rosdep experienced an error: Unable to handle package.xml forma ...

  6. ERROR: Unable to start Xvfb on any port in the range 6600 - 6619.

    Ubuntu安装ArcGIS Server10.3.1,问题解决: 发现链接无法访问:开始排查问题 跳转到安装的路径,/home/arcgis/arcgis/server 启动 报错 ERROR: U ...

  7. python2 安装faiss-gpu 报错 faiss/faiss/python/swigfaiss.i:241: Error: Unable to find ‘faiss/impl/platfo

    1. 安装报错 $ sudo pip install faiss-gpu --default-timeout=1000 -i https://pypi.douban.com/simple DEPREC ...

  8. Git error: Unable to negotiate with X.X.X.X : no matching host key type found . their offer: ssh-dss

    2019独角兽企业重金招聘Python工程师标准>>> I am trying to create a git repository on my web host and clone ...

  9. PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0

    为什么80%的码农都做不了架构师?>>>    不同电脑,相同的代码怎么就上传不了图片:本人用的是PHP upload上传项目下的retime文件夹 服务器突然出现这种提示,无法上传 ...

  10. Windows下运行rabbitmqctl 相关命令(如rabbitmqctl stop)报错:Error: unable to perform an operation on node解决方案

    Windows下运行rabbitmqctl 相关命令(如rabbitmqctl stop)报错:Error: unable to perform an operation on node解决方案 参考 ...

最新文章

  1. oracle表空间可以迁移,Oracle 表空间迁移
  2. java开发简历编写_如何通过几个简单的步骤编写出色的初级开发人员简历
  3. 使用FreeRTOS进行性能和运行时分析
  4. sql between的用法的意思_SQL 宝典——SQL 语法速成手册
  5. 原生Ajax详细获取数据
  6. 2023年最新谷歌Google帐号Gmail邮箱账号怎么注册成功的方法与教程?
  7. oracle yyddd格式转换,Oracle PL/SQL开发基础(第二十二弹:类型转换函数)
  8. 84. 从视图索引说Notes数据库(下)
  9. Linux查看服务器SN序列码
  10. 使用Unity和A*插件实现LoL英雄联盟中的移动方式
  11. javascript笛卡称积
  12. 名帖30 东汉 隶书《西岳华山庙碑》
  13. APP - 朋友圈广告原来是可以关掉的
  14. 玩转SQL语句之group by 多字段分组查询与having子句,一篇解决你的疑惑!
  15. cocos-lua环境搭建
  16. 我的世界服务器武器修改伤害,我的世界改伤害指令 | 手游网游页游攻略大全
  17. [HAOI2005] 破译密文
  18. ubuntu下查看硬件信息等指令整理,安装并简单运行HotSpot
  19. 2022 年苹果新品预测:iPhone 14 采用“挖孔屏”、Mac 全面升级?
  20. Windows下base64编解码命令

热门文章

  1. Head First Java
  2. LoadRunner教程(13)-LoadRunner 服务水平协议
  3. 计算机无法打印图片,Win7电脑连接打印机可以打印文档不能打印图片怎么办
  4. 使用 Beyond Compare 和版本控制系统
  5. 解决斑马打印机打中文的问题
  6. roseha-mirror oracle数据库同步 可靠性,RoseHA集群:RHEL+RoseMirror+Oracle【1】
  7. Autodesk AutoCAD 2018 for mac
  8. 全减器的原理与vhdl实现
  9. Wallpaper Engine软件——html做为壁纸
  10. 仿英雄联盟LOL网页设计作业 HTML CSS游戏官网网页模板 大学生游戏介绍网站毕业设计 DW游戏主题网页模板下载 游戏娱乐网页成品代码 英雄联盟网页作品下载