1 Star 0 Fork 39

王先森 / UltraLink

forked from ReferenceZ / UltraLink 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

UltraLink:迷你多功能调试器&离线下载器

image-20220820212032105

0. 功能概述

UltraLink是基于CMSIS DAP设计的一款多功能调试下载器,特性如下:

  • 基于STM32F4高性能主控,168MHz主频,1MB内置Flash
  • 支持高速Bootloader用于系统固件升级(可用于后续扩展更多APP和支持的芯片型号)
  • 板载USB-HS PHY芯片,支持高速USB通信,且完全免驱即插即用
  • 使用标准的CMSIS-DAP在线调试下载协议,兼容各种DAP-Link,支持Keil、支持基于OpenOCD的CLion、STM32CubeIDE、VS Code等各种IDE
  • 支持大量Cortex-M系列芯片的离线固件下载,支持设置下载地址
  • 板载64MB外置Flash芯片用于MSC设备,可以模拟U盘直接管理需要离线下载的固件文件
  • 支持USB虚拟调试串口功能,支持超高波特率(921600)无丢包
  • 搭载128x128的超高刷新率Sharp Memory LCD,120Hz的流畅,MLCD长时间显示不烧屏
  • 3.5x3.4x1.0CM超小尺寸,全铝CNC+阳极氧化机身
  • 搭载极致丝滑的MonoUI交互系统
  • 持续集成更多扩展功能(电压表、逻辑分析仪、CAN调试器等)

1. 硬件说明

LED指示 状态 功能说明
红色 常亮 未连接电脑(或驱动错误)
蓝色 闪烁 下载器与MCU或者电脑通信中
蓝色 呼吸 已进入Bootloader模式
绿色 常亮 已连接电脑

连接电脑

UltraLink通过USB TypeC数据线连接电脑后,会自动安装虚拟串口以及CMSIS-DAP驱动,Windows10以上系统完全免驱。

安装完成之后,打开电脑的文件管理器会看到识别出来的一个 64MB 大小的 U盘设备 (可以自行重命名),通过该设备可以直接把离线烧录的文件和其他配置文件拖入U盘,来写入到UltraLink板载的Flash中。

初次使用UltraLink会自动进行系统初始化,U盘目录下会建立一些系统文件夹, 请勿删除这些文件!

系统文件说明:

  • SETTING:用于备份用户设置(未来会用到)
  • SRC:储存一些系统资源比如图片、metadata等
  • LICENSE:设备的授权文件,出厂会对设备进行激活,该文件和每台设备唯一绑定,因此建议收到机器后首先将此文件进行备份,以防止未来格式化磁盘后文件丢失。

此外打开设备管理器,可以在端口(COM和LPT)中看到多出来一个串口号,可以使用电脑上的各种串口调试工具打开该串口号进行调试,和其他USB转串口模块的使用是一样的。

设备管理器中还会在通用串行总线设备中识别出一个名为UltraLink REF的设备,这是预留的USB Bulk通信设备,用于实现更多高速USB通信应用,比如屏幕镜像APP和未来的一些其他应用。

引脚说明

UltraLink有两排10Pin的排针,排针的引脚功能定义在屏幕的主界面有说明。

靠近屏幕的一排是Row-1,下面的一排是Row-2Row-1Row-2最左边的第一个引脚都是Gnd,对应于外壳上面的凹刻图标指示。

2. 操作说明

第一次使用UltraLink时会进行操作指引,如果后续还想看到引导画面,请在设置中恢复出厂设置。

具体操作逻辑非常简单:

  1. 滚动UltraLink右侧的滚轮,上下滚动用于切换选中条目,短按压确认操作,长按压返回操作。

    上电默认进入的是Home界面

  1. 短按滚轮为确认,在Home界面短按会进入APP菜单界面,上下滚动滚轮切换所需的APP功能:

image-20220820232617060

  1. 在任意界面长按滚轮为取消或者返回上一级页面

3. APP使用说明

1. CMSIS-DAP在线下载&调试

UltraLink是一个扩展性非常强的多功能调试器,设备的每一项功能都作为一个APP

其中CMSIS-DAP调试器功能是最特殊的APP,该APP无需开启,在任意APP功能页面下,UltraLlink都具备在线调试器功能。

也就是说UltraLink支持同时运行CMSIS-DAP的在线下载调试功能以及其他APP。

只有一个场景不能同时使用,也就是当在使用离线下载功能进行固件下载过程中,此时SWD的IO是被离线下载功能占用的,因为不可能同时进行在线下载和离线下载。

DAP在线下载调试功能使用的引脚是SWCLKSWDIO,也就是标准的SWD接口。

设备也支持JTAG接口,不过该接口我用得比较少所以还没有大量测试。

UltraLink作为在线调试器的使用和ST-Link、J-Link等都一样。

对于Keil,只需要在项目设置中选择CMSIS-DAP即可:

对于STM32IDE、VS Code、CLion等使用OpenOCD调试的IDE,可以参考仓库中的 2.配套软件/OpenOCD配置文件 ,修改.cfg文件中的接口为cmsis-dap即可。

不熟悉操作的同学可以搜索DapLink相关的教程,UltraLink的操作流程和方法是一样。

2.离线固件下载

该功能用于脱机下载固件,也即不需要连接电脑即可给MCU烧写固件,很适合用于自制设备的量产烧写。

将需要下载的固件拖入UltraLink的U盘设备,重启UltraLink之后可以在选择固件文件中看到固件文件。

固件文件的文件名只能是英文,而且长度最好不大于32字符,建议只使用字母-_的组合。

image-20221207105242740

选择芯片型号用于设置对应的下载算法,默认内置了STM32F1STM32F4STM32F7等芯片,后续会持续扩展更多的芯片型号支持。大家有想要适配的芯片型号可以在本仓库的Issues里面提出,这边会根据实际情况适配。

更新支持芯片型号需要通过Bootloader更新UltraLink的固件来实现。

设置下载地址用于修改烧录的起始地址,该功能正常使用保持默认即可。对于一些需要配合Bootloader使用的固件可以通过该功能设置地址偏移。

一般Bootloader固件会放在芯片Flash最开始的启动地址,而实际应用代码会放在一个偏移地址,这样就能实现上电后首先进入BL,由BL判断是否进行一些特殊操作,或者直接跳转到APP地址。

因此用下载器这类应用烧写固件时,一般会烧录两次,一次在默认地址烧写BL,一次在偏移地址烧写APP。

自动触发下载用于开启或关闭连续固件下载功能,当不开启时,需要手动点击开始下载进行固件下载,当开启时,只需将光标移动到指示位置,然后把SWD引脚接触目标板卡,就会自动触发下载。用此方法可以快速连续下载多个板卡的固件,可以大幅提高批量下载的效率,很适合用于量产固件烧录。

储存当前设置可以将当前配置好的下载设置(芯片型号、下载地址)进行断电保存,下次上电就会加载该配置。

擦除芯片用于单独擦除整个目标芯片。

3.USB转串口

UltraLink使用USB转串口来实现很多调试功能,在不同界面下串口的功能可能有所不同

在Home界面下,UltraLink支持标准USB转串口功能,也就是说当用串口调试助手对UltraLink识别出来的COM口进行数据发送时,数据会被发送到设备的Tx引脚,反之,Rx引脚接收到的数据会被发送到USB虚拟COM口号上。

image-20221207104212737

image-20221207104307325

4.CAN转串口调试

该APP为一个方便的CAN调试功能,无需安装三方软件,直接通过串口调试助手即可以调试CAN,非常方便。

由于该功能会占用USB串口号,因此进入该APP之后默认的标准USB转串口功能会失效。

image-20221207111125687

进入APP后可以看到显示的UltraLink本机的CAN节点地址,目前只支持标准ID,也即0x000~0x7FF,默认地址是0x7FF,可以通过滚轮进行修改,修改实时生效

向下滚动滚轮直到黑色条处显示Baud则进入了设置波特率功能,此时短按滚轮可以在不同波特率之间进行切换,修改实时生效

在Baud界面再次向下滚动滚轮会显示Exit,此时短按滚轮确认可以退出APP。

任意界面长按滚轮都会跳转到Exit界面,再次短按即可退出。

在该APP开启后,打开串口调试助手,当CAN-HCAN-L引脚有数据接收时,串口助手会打印出接收到的CAN消息,包括消息节点的ID以及数据。

而当使用串口助手发送格式形如 12 33 67 78 99格式的字符串数据时,也会通过CAN-HCAN-L引脚把数据转发给CAN总线。

注意发送的数据为16进制格式,每次可以是1~8个字节,比如上面的例子中是发送5个字节。

使用串口协议的好处是使用直观,不依赖其他软件,而且大家也可以根据需要自己写代码调用COM口进行协议自定义,比如可以用PySerial写一个脚本来收发自定义格式的CAN数据。

v3.7之后的版本固件初步增加了对于CAN调试APP的扩展帧ID支持,无需在下载器上设置,直接串口输入指令即可修改参数,比如:

  • 输入指令#SET_MODE 0或者#SET_MODE 1来切换标准帧和扩展帧

  • 输入指令#SET_ID 12345来设置ID为0x12345

注意指令需要加换行。

5. 简易电压表

该功能用于进行电压测量,支持的测量范围为0~20V,测量过程会同时显示电压波形数据。

由于UltraLink的控制器芯片IO电平为3.3V,因此除了指示的ADC引脚之外,别的引脚接入高压都可能导致芯片烧毁,请务必注意不要接错测量引脚。

image-20221207111445041

6. 简易逻辑分析仪

该功能用于进行简易的数字波形采集以及协议分析,具备4通道采集功能,需要配合上位机软件PulseView定制版使用。

由于SRAM限制,UltraLink的采集参数为:

  • 采样深度最大10.24k
  • 采样率可以设置为20KHz~5MHz,此时支持4通道采集
  • 采样率可以设置为20MHz,此时支持2通道采集

采样参数的配置完全依靠上位机操作,UltraLink上无需任何配置,但是会显示当前的参数。

image-20221207111543972

由于芯片的SRAM大小限制采样深度,因此本设备只适合用于简易场景的逻辑分析,并不能替代专业分析仪。很常用的场景是分析一些总线协议,或者进行波形时间测量。

我个人需要逻辑分析仪的一个常用场景是:想测量一段代码的执行时间,但是代码执行的频率很高,用printf打印时间戳的方式不可行,那么可以用逻辑分析仪检测IO电平反转时间来准确得到时间间隔。

大家可能经常用printf打印一些调试数据,但是实际上printf本身的执行时间是很长的(接近ms级别),因此如果测量的代码执行时间很短,那么printf其实完全不可用;此外printf的实现方式也导致其效率差别很大(阻塞输出、DMA输出等)。

因此比如我在调试电机的时候,需要在每个PWM周期(20kHz)中执行一遍处理代码,我希望测出代码执行时间,那么显然printf是无法使用的;我可以用寄存器方式操作一个GPIO进行翻转,代码开始时置高电平,结束时置低电平,再使用逻辑分析仪测出波形,就可以精确地得到代码运行时间了。

上位机软件PulseView定制版安装方法,直接运行安装包即可。

再连接设备之前需要给UltraLink配置一下串口驱动,使用Zadig软件完成:

image-20220821000642238

List All Devices后,选择UltraLink CMSIS-DAP (Interface 1)设备,注意确认此时Driver栏显示的是usbser才是正确的设备号。

image-20221207112515936

点击下箭头选择USB Serial (CDC),然后勾选上方的Edit框,把左边的名称改为UltraLink VCP,再点击Upgrade Driver即可,等待一分钟左右。

正确操作的话此时设备管理器中的串口设备名称以及变为UltraLink VCP

image-20221207112611603

然后进入UltraLink的逻辑分析仪APP界面,再打开PulseView软件,依次点击:

image-20220821001143048

image-20220821001211981

即可连接设备。

注意此时UltraLink一定要是在DLA的APP页面下,否则上位机是识别不到设备的

如果在非DLA的界面下点击了Scan可能会卡住,那么需要先切换到DLA界面,再关闭PulseView重新进入一下即可。

连接后可以点击PulseView中的Run进行一次波形采集,也可以软件中设置不同采样深度和采样率。

image-20221207112935731

采样深度的意思是每次最多可以采样几个点,采样率的意思是采集的速度。

举个例子,以10K的采样深度,1MHz的采样率进行采样,那么就可以采集10K/1M=0.01s钟的波形。所以采样率越高对于信号的分析能力越强,但是过高的采样率会导致采样时间变短。

一般需要选取采样率为被测信号的最高频率5倍以上。

其他APP

待持续更新。

参考资料:

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

UltraLink的固件&工具发布仓库 展开 收起
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/Fredoom/ultralink.git
git@gitee.com:Fredoom/ultralink.git
Fredoom
ultralink
UltraLink
master

搜索帮助