当前文档版本为 NDK-v0.6.0,您可以访问当前页面的 开发中 版本以获取最近可能的更新。

BLE Peripheral ENC

1 功能概述

此项目演示从机ANS服务以及自定义加密特性演示功能,可以配合主机sampleble central演示主从连接,同时也可以配合手机nrf connect演示配对加密功能。

2 环境要求

  • board: pan107x evb

  • uart(option): 用来显示串口log(波特率921600,选项8n1

  • 手机app nrf connect

3 编译和烧录

pan107x芯片例程位置:<home>\nimble\samples\bluetooth\bleprph_enc\keil_107x

pan101x芯片例程位置:<home>\nimble\samples\bluetooth\bleprph_enc\keil_101x

使用keil进行打开项目进行编译烧录。

4 演示说明

  1. 烧录完成后,设备会显示上电log,连接上会显示Connection established,主机订阅完成后输出subscribe event;

    [11:46:57.699]LL Controller Version:bd5923c
    
    [11:46:57.736]ble_store_config_num_our_secs:0
    ble_store_config_num_peer_secs:0
    ble_store_config_num_cccds:0
    registered service 0x1800 with handle=1
    registering characteristic 0x2a00 with def_handle=2 val_handle=3
    registering characteristic 0x2a01 with def_handle=4 val_handle=5
    registered service 0x1801 with handle=6
    registering characteristic 0x2a05 with def_handle=7 val_handle=8
    registered service 0x1811 with handle=10
    registering characteristic 0x2a47 with def_handle=11 val_handle=12
    registering characteristic 0x2a46 with def_handle=13 val_handle=14
    registering characteristic 0x2a48 with def_handle=16 val_handle=17
    registering characteristic 0x2a45 with def_handle=18 val_handle=19
    registering characteristic 0x2a44 with def_handle=21 val_handle=22
    registered service 59462f12-9543-9999-12c8-58b459a2712d with handle=23
    registering characteristic 33333333-2222-2222-1111-111100000000 with def_handle=24 val_handle=25
    registering descriptor 34343434-2323-2323-1212-121201010101 with handle=27
    
    [11:46:57.796]Device Address: 01 02 03 04 05 06
    
    [11:47:00.271]connection established; status=0 handle=0 our_ota_addr_type=0 our_ota_addr=01 02 03 04 05 06
     our_id_addr_type=0 our_id_addr=01 02 03 04 05 06
     peer_ota_addr_type=0 peer_ota_addr=06 06 03 04 05 06
     peer_id_addr_type=0 peer_id_addr=06 06 03 04 05 06
     conn_itvl=32 conn_latency=0 supervision_timeout=256 encrypted=0 authenticated=0 bonded=0
    
    [11:47:02.454]subscribe event; conn_handle=0 attr_handle=19 reason=1 prevn=0 curn=1 previ=0 curi=0
    
  2. 使用手机 nrf connect 扫描蓝牙设备名称nimble-bleprph并且连接

    image

    nrf connect连接nimble-bleprph

5 RAM/Flash资源使用情况

PAN107x:

RAM Size:35.17 k
Flash Size: 147.96k

PAN101x:

RAM Size:14.23 k
Flash Size: 135.34k