1 Star 0 Fork 15

卖菇凉小蘑菇 / air105_project

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

关于

air105_project 是AIR105 MCU在Keil5 MDK下的项目模板, 支持 DAP-Link 烧录和调试

关于AIR105

AIR105是合宙LuatOS的一款芯片, Cortex-M4F内核, 最高频率204Mhz, 片上内建640KB SRAM和4MB Flash. QFN88封装, 尺寸10x10mm, 56个可编程GPIO PIN.

功能特性

AIR105 和兆讯的 MH1903S 是同一款芯片, MH1903系列还有 BGA169 等高密度封装

具体的功能特性

  • ARM SecurCore™ SC300™核心
    • 32-bit RISC Core(ARMv7-M)
    • MPU 内存保护单元
    • 最高 204MHz 主频(1、2 分频可调)
    • FPU 单元
    • 1 个受控 JTAG-DP/SW-DP 调试端口
  • 640KB SRAM
  • 1 个 QSPI 控制器, 支持 XIP
  • 系统控制模块(控制所有外设模块时钟及系统相关配置)
  • 安全加密算法加速引擎
    • 对称算法: DES、TDES、AES-128/192/256
    • 非对称算法: RSA-1024/2048、ECC
    • HASH 校验算法: SHA-1/224/256/384/512
  • 2 路 SmartCard 接口(支持 EMV Level-1 协议规范、ISO7816-3 标准), 其中 SCI0 集成 7816 电平转换功能, 可配置输出 3V 和 1.8V
  • 4 路 UART 接口(均支持 4 线)
  • 3 路 SPI 接口(其中 SPI0 主从可配, 其他 2 路仅支持 Master) * 1 路高速 SPI Master 接口 SPI5
  • 1 路 IIC 接口
  • 1 路 KBD(4x5 矩阵键盘)
  • 8 个 32 位 TIMER(带有 PWM 功能, 支持单周期输出)
  • 1 路 LCDI 接口, 支持 8080、6800 总线协议
  • 1 个真随机数发生器
  • 1 个 DMA 控制器(支持 8 通道 DMA 传输)
  • 1 个 CRC 模块(支持 16Bit/32Bit、多种常用多项式计算)
  • 最多支持 87 个 GPIO
  • 最多支持 8 个静态 Tamper 或 4 组动态 Tamper(4 输出, 4 输入), 动/静态可配
  • 1 组内部 Sensor(支持高低电压、高低温、Mesh、时钟和 voltage glitch 检测)
  • 1 块密钥存储区(支持硬件快速擦除)
  • 1 个 USB(OTG-FS)
    • 支持 USB2.0 和 OTG1.0a
    • 内置 USB PHY 模块
    • 专用 DMA 通道和专有的中断向量, 加快数据通信速度
  • 集成内部看门狗
  • 1 个 10bit DAC 接口
  • 1 个 7 通道 12bit ADC, 最高支持 857KHz 采样率(0 通道固定采集 CHARGE_VBAT 电压, 其余通道采集电压范围 01.8V 或 03.6V 可配)
  • 支持磁条解码功能, 支持 ISO/ABA、AAMVA、IBM 和 JIS II 等标准卡
  • 1 个 DCMI 接口
  • 芯片集成一个可对外输出 150mA 驱动能力的 LDO
  • 芯片集成 USB 充电管理模块, 支持最大 200mA 的充电电流
  • 芯片集成开关机功能
  • 支持 27.12M 输出

资料下载

使用Keil MDK + DAPLINK 烧录和 Debug

合宙提供了这个芯片及开发板的 LuatOS 开发环境和工具链, 但还是有很多开发用户希望能使用纯C语言的环境和工具链, 以下说明如何在Keil5 MDK中使用 DAP-Link 烧录 AIR105 开发板.

准备工作

硬件

  • AIR105开发板 需要引出PC3口, 并取消PC3口的输出状态, 查看最下面附录中的说明
  • DPALink转接卡 可以使用标准的DAP-Link, 也可以使用WCH-Link卡(需要切换到DAP-Link状态), 这两种卡都测试过, 体现在软件中是一样的, 都可以使用

注意: 如果使用WCH-Link, 一定要看清电压, 别误接板上的5V输出.

软件

  • 预先安装好 Keil5 MDK, 以下假设使用的是默认的安装目录 C:\Keil_v5
  • 下载好示例项目并在Keil5 MDK中打开, 下载地址
  • 下载FLM文件备用, 位于仓库的Docs目录下

接线

3.3V和GND在Air105开发板上有好几组, 选一组连即可

# DAP-Link -> Air105 Dev-Board

3.3V       -> 3.3V 
GND        -> GND
SCK        -> PC4 版上标识为 ADC5
SWD        -> PC3 根据上面的说明额外接出

配置Keil5 MDK

连接开发板

开发板通过DAP-Link连上电脑后, 如果 Debug 的 SW Device 中能看到 IDCODE 为 0x2BA01477 的设备, 就说明 DAP-Link 连接已经正常了, 识别 DAP-Link 和 Air105 不需要安装额外的软件

1. 下载Flash算法文件

烧录还需要配置Flash算法文件, 下载本仓库Docs目录下的FLM文件, 放到 C:\Keil_v5\ARM\Flash 目录下(这个目录下能看到其他芯片的 .FLM 文件).

2. 在Keil MDK中的设置

  1. 在Keil MDK中, 点击 Project -> Option for Target ... 打开配置对话框, 切换到 Debug 标签页
  2. 在Use中选中 CMSIS-DAP Debugger, 点击 Settings 打开对话框, 如果前面都操作正确的话, 这里在SW Device中能看到一个IDCODE为 0x2BA01477的设备
  3. 在这个对话框中, 左侧的 CMSIS-DAP - JTAG/SW Adapter 中, 将 Max Clock 修改为 10MHz. 默认的1MHz会导致写入时报 AIR105.FLM 文件无法载入的错误.

3. 设置FLM和内存大小

  1. 在这个对话框, 切换到Flash Download标签页, 可以看到 Programming Algorithm 列表是空白的, 点击 Add, 选中 Air105, 点击 Add 添加到列表
  2. 在这个对话框的右上角, RAM for algorithm 部分, 将 Size 修改为 0x00004000. 默认为 0x00001000, 会报内存不足
  3. 在这个对话框勾选 Reset and Run, 然后点击 OK 保存

4. 烧录

经过上面的配置, 应该就可以直接按F8烧录了

5. Debug

Debug 和普通的 STM32F103 系列一样, 通过 Keil MDK 的 Debug 菜单可以直接进入.

附录

硬件调整: 接出PC3的具体步骤

工具部分

  • OK线, 用于引出PC3,
  • 特尖烙铁头, 搜索型号 900-SI, 900M-T-IS, 900M-T-I 这类特尖头和特尖弯头, 因为PC3对应的电阻为0402, 与开关贴得很近, 普通烙铁头不容易焊接
  • 普通焊锡丝
  • UV559(或者类似的, 非酸性)助焊油

焊接

使用DAP-Link连接需要4根线: VCC, GND, SWCLK 和 SWDIO, 其中 SWCLK对的是PC4, 这个pin脚是现成的; SWDIO对的是PC3, 这个开发板并未接出PC3, 所以需要自行焊接引出.

根据开发板线路图, 靠近开关一侧的LED通过一个5K的电阻连接了PC3, 所以只需要从这个电阻的一侧引出接线即可. 位置可以参考下图的红框部分.

可以使用图中这种固定方式, 焊排针时多留一个排针, 将线一端先固定好, 另一端让线尖正好搭在电阻的一侧. 在线尖处加上助焊剂后, 烙铁尖头搭一点锡后将线焊上. 注意锡不能多, 时间不能太久. 焊完要用万用表检查一下, 量排针到电阻的另一侧, 阻值是否正确.

修改PC3口输出状态

如果开发板还处于出厂状态, PC3用于点亮LED, 会处于输出状态, 所以此时开发板通过DAP-Link连上电脑后, Keil中查看DAP-Link设备会显示 DAP Error, 需要先刷入其他固件, 将PC3口的输出状态修改掉.

烧录使用 Luatools, 参考烧录说明. 可以自己制作(看最后的说明), 或者使用这个已经制作好的soc 点击下载

烧录成功后, PC3口不会再用于输出, 串口会输出大量杂乱内容, 可以忽略.

制作soc文件

soc文件其实是一个压缩文件, 用7zip之类的工具打开后, 可以将其中的app.bin移除, 换成自己的app.bin.

在keil mdk中生成 bin 格式固件

以 Blink 这个项目为例

  1. 打开项目配置文件 Options for Target ...
  2. 切换到 User 标签页, 在 After Build/Rebuild 下, 勾选 Run #1, 填入要执行的内容, 填入
C:\Keil_v5\ARM\ARMCLANG\bin\fromelf.exe --bin -o  .\Objects\Blink.bin .\Objects\Blink.axf

不同的项目, 其相对路径可能不一样, 需要自行调整

自建项目, 写入报 No Algorithm found 错误

完整错误为

No Algorithm found for: 00000000H - 00001183H

这是因为AIR105的 __ROM_BASE 与标准的 ARMCM4 不一样, 需要修改项目中的 ARMCM4_ac6.sct 文件, 按下面的数值调整

#define __ROM_BASE      0x01001000
#define __ROM_SIZE      0x00080000

#define __RAM_BASE      0x20000000
#define __RAM_SIZE      0x000A0000

#define __STACK_SIZE    0x00000200
#define __HEAP_SIZE     0x00000C00

参考

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.

简介

AIR105 Keil5 MDK 项目模板 展开 收起
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/qq1847123212/air105_project.git
git@gitee.com:qq1847123212/air105_project.git
qq1847123212
air105_project
air105_project
master

搜索帮助