用户工具

站点工具


cc2640r2f:first_example

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

cc2640r2f:first_example [2017/09/04 21:59]
wuyl
cc2640r2f:first_example [2021/06/22 23:14]
行 1: 行 1:
-<markdown> 
- 
-# 下载运行第一个程序 # 
- 
-## 介绍 ## 
- 
-本章使用<a href="http://docs.leconiot.com/doku.php?id=cc2640r2f:leconiot:cc13x0_cc26x0_evaluation_board:cc13x0_cc26x0_evaluation_board"> CC2640R2F Evaluation Board </a>作为实验平台下载运行 `simple_peripheral` 工程。旨在为开发者建立一个 BLE 的感性认识。 simple_peripheral 的 IAR 工程可以在目录 C:\ti\simplelink_cc2640r2_sdk_1_35_00_33\examples\rtos\CC2640R2_LAUNCHXL\ble5stack\simple_peripheral\tirtos\iar 下找到。 
-有关工程配置和编译选项以及下载方法参考<a href="http://docs.leconiot.com/doku.php?id=cc2640r2f:get_started:development_environment_set_up:development_environment_set_up"> CC2640R2 BLE 开发环境搭建</a>部分和<a href="http://docs.leconiot.com/doku.php?id=cc2640r2f:cc2640r2f_architecture:iar:development_with_iar">使用 IAR 进行开发</a> 
- 
-simple_peripheral 工程实现了具有 GATT 服务的蓝牙低功耗外设,该工程会作为后面协议栈讲解的基础程序。 
- 
-## 硬件环境 ## 
- 
-使用 USB 连接<a href="http://docs.leconiot.com/doku.php?id=cc2640r2f:leconiot:cc13x0_cc26x0_evaluation_board:cc13x0_cc26x0_evaluation_board">CC2640R2F Evaluation Board</a>。确保跳线帽正确连接,如下图所示 
- 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/picture.jpg) 
- 
-成功连接开发板之后,打开电脑的设备管理器。可以看到 XDS110 的两个端口,接下来打印使用串口 `XDS110 Class Application/User UART(COM25)`  
->**注意**:XDS110 驱动程序在安装 IAR 时会默认安装,如果你没有安装 IAR ,可以手动更新驱动程序软件,XDS 驱动可以在<a href="..\..\get_started\development_tools_kit\develpoment_tool_kits.html"> CC2640R2 开发工具集介绍</a>里获得。 
- 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/XDS110.png) 
- 
-## 软件环境 ## 
- 
-- IAR Embedded workbench 7.80.3 
-- BLE-STACK V3.0.1 
-- flash_programmer 2 
-- PuTTY_0.67.0.0.exe 
-- BLE Scanner 
- 
-协议栈和 IAR 安装以及工程编译参考<a href="http://docs.leconiot.com/doku.php?id=cc2640r2f:get_started:development_environment_set_up:development_environment_set_up"> CC2640R2 BLE 开发环境搭建</a> 编译参考 <a href="http://docs.leconiot.com/doku.php?id=cc2640r2f:get_started:first_build:first_project_buid">编译第一个工程( simple_peripheral )</a>,还需要使用 PuTTY ,一款基于 windows 的控制台打印工具。手机端需要安装 BLE Scanner APP 。所有工具可以在<a href="http://docs.leconiot.com/doku.php?id=cc2640r2f:get_started:development_tools_kit:develpoment_tool_kits"> CC2640R2 开发工具集介绍</a>里获得。 
- 
-## 程序下载 ## 
- 
-提供两种方式进行程序下载,如果用户已经安装了 IAR 并且搭建好了开发环境后可以直接使用 IAR 进行下载;如果用户目前还没有安装 IAR ,可以使用flash_programmer 进行固件下载。 
-下面说明如何使用 flash_Programer 2 进行程序下载: 
-1. 连接开发板并打开 Flash_Prorammer 2 软件,在 Connected devices 界面可以看见我们的设备。 
-2. 点击 browser 按键,在 C:\ti\simplelink_cc2640r2_sdk_1_35_00_33\examples\rtos\CC2640R2_LAUNCHXL\ble5stack\hexfiles 路径下找到 cc2640r2lp_simple_peripheral.hex 文件并打开。 
-3. 勾选 Erase ,选择 All unprotected pages 。 
-4. 勾选 Program,选择Entire source file 。 
-5. 勾选 Verify 选择 Readback 。 
-6. 点击 run ,即可完成固件下载。 
- 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/flashprogrammer.png) 
- 
-## Service/Profile 表 ## 
- 
-该工程包含一个服务( Service ), 5 个特征值( characteristic )。 
-注意下面的 UUID 值,使用 BLE Scanner 可以获得 128 位的 UUID ,该shishi生成的是 16 位的 UUID 。 
- 
-|characteristic|UUID|格式|属性|资料来源| 
-|:---:|:---:|:---:|:----|:----| 
-|1|FFF1|1 byte|读/写|peripheral.c / simple_gatt_profile.c| 
-|2|FFF2|1 byte|读|peripheral.c / simple_gatt_profile.c| 
-|3|FFF3|1 byte|写|peripheral.c / simple_gatt_profile.c| 
-|4|FFF4|1 byte|通知|peripheral.c / simple_gatt_profile.c| 
-|5|FFF5|5 byte|读|peripheral.c / simple_gatt_profile.c| 
- 
-## 用法 ## 
-使用putty的串口功能作为该项目的串口显示器。使用以下参数配置putty串口。 
- 
-|UART参数|默认值| 
-|:---|:---| 
-|波特率|115200| 
-|数据长度|8 bit| 
-|Parity|None| 
-|Stop bits|1 bit| 
-|Flow Control|None| 
- 
-当 Simple Peripheral程序启动,可以在putty上看见项目名称,广播状态,设备地址,如下图所示。 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/addvertising.png) 
-广播是在程序启动后默认启动的,打开手机的BLE Scanner扫描设备,可以看见一个名为SimpleBLEPeripheral的设备。 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/Scanner.png) 
-如果有多个名称为SimpleBLEPeripheral的设备,可以通过左侧的RSSI数值来判断需要连接的设备,该值表示蓝牙的信号强度。一旦连接上设备,终端窗口将显示智能手机的设备地址。 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/address.png) 
-连接成功之后,可以通过按键设置PHY的首选项,关于PHY更多描述,参考<a href="..\..\ble_stack_app\stack\le_2m_phy\le_2m_phy.html">LE 2M PHY</a> 
-在BLE Scanner中,你可以看到有关SimpleBLEPeripheral更多信息。 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/FFF0.png) 
-点开CUSTOM SERVICE,这是用户自定义服务,其中包含5个characteristic,并显示了每个characteristic的信息。 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/characteristic.png) 
- 
-### characteristic 1 (UUID:FFF1) ### 
-characteristic 1具有读写属性,包含一个字节长度的值。如下图所示。 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/FFF1.png) 
-按下R按钮后,可以读取characteristic的值,显示在HEX后面,默认是0x01。按下写入按钮后,出现写入弹窗,可以写入1字节任意数字,再次点击读取可以获取刚才写入的值。并且可以在putty中断看见写入的ASCII值。这里我们写入的是2,对应ASCII码为50. 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/write.png) 
-每个用户特征值下面都有一个R按键,可以读取特征名称。如下图所示。 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/name.png) 
- 
-### characteristic 2 (UUID:FFF2)  ### 
-此特征值仅具有读属性。默认值为0x02.可按照characteristic 1方式进行读。 
-### characteristic 3 (UUID:FFF3)  ### 
-此特征值仅具有写属性,默认值为0x03.可按照characteristic 1方式进行写。 
-### characteristic 4 (UUID:FFF4)  ### 
-此特征值仅具有通知属性,通过点击N按键打开通知属性,打开后它会将characteristic 3的值以通知的方式发送出来。手机端接收到之后显示在界面。如下图所示。 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/nitify.png) 
-并且还可按下特征值配置旁边的读取按钮显示是否已经启动了通知。 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/notifyconfig.png) 
-### characteristic 5 (UUID:FFF5)  ### 
-characteristic 5仅具有读属性,它是5个字节,默认值为0x0102030405.它与其他特征值不同的是它需要认证。通过智能手机与外设配对来完成。默认的密码是0000,当配对成功,才能读取到正确内容。 
-![](http://www.leconiot.com/md_res/cc2640r2f/get_started/first_example/image/FFFF5.png) 
- 
-## 加入我们 ## 
-文章所有代码、工具、文档开源。加入我们[**QQ群 591679055**](http://shang.qq.com/wpa/qunwpa?idkey=d94f12d37c3b37892af4b757c6dc34bea140f3f3128a8d68e556a3d728148e85)获取更多支持,共同研究CC2640R2F&BLE5.0。 
-<div> 
-<p align="right"> 
-<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=d94f12d37c3b37892af4b757c6dc34bea140f3f3128a8d68e556a3d728148e85"><img border="0"  src="http://pub.idqqimg.com/wpa/images/group.png" alt="CC2640R2F&BLE5.0-乐控畅联" align="right" title="CC2640R2F&BLE5.0-乐控畅联"></a> 
-© Copyright 2017, 成都乐控畅联科技有限公司.   
-</p> 
-</div> 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
-</markdown> 
  
cc2640r2f/first_example.txt · 最后更改: 2021/06/22 23:14 (外部编辑)