BT Basic Application

BLE Peripheral

Functional Description

BLE Peripheral is a simple BLE peripheral application. It can broadcast Bluetooth advertisements and be connected to by other devices.

Supported SOCs

Ameba SOC

RTL8721Dx

RTL8726EA

RTL8720EA

RTL8713EA

RTL8730E

RTL8721F

Support State

Y

Y

Y

Y

Y

Y

Compile

    1. Enter {sdk}/amebaxxx_gcc_project directory

    1. Run the menuconfig.py command in the Windows Command Prompt or Linux terminal to enter the configuration interface as shown below:

    ../../../_images/ble_peripheral_menuconfig.png

    Enter the CONFIG BT configuration, select Enable BT to enable the Bluetooth function, and then select BLE Peirpheral.

    1. Run the build.py command in the Windows Command Prompt or Linux terminal to compile the project.。

Example

  • To enable the BLE Peripheral function, use the AT command AT+BTDEMO=peripheral,1 .

    AT+BTDEMO=peripheral,1
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:04:06]
    HCI Revision is 0x000e, LMP Subversion is 0x8720.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v3
    FW Version: 20250421202736
    FW Length: 77317
    Start upper stack
    [APP] BD_ADDR: 00:E0:4C:80:04:06(public)
    [APP] simple ble service register succeed!
    [APP] DIS register service succeed!
    [APP] HRS register service succeed!
    [APP] BAS register service succeed!
    [APP] IAS register service succeed!
    [APP] GLS register service succeed!
    [APP] Long uuid service register succeed!
    peripheral example enable OK!
    
    [MEM] After do cmd, available heap 513056
    
    #
    [APP] ADV started: adv_type 0
    
  • You can successfully establish a Bluetooth connection with the device by scanning for the broadcast with the corresponding Bluetooth address on your mobile phone and initiating a connection.

    [APP] ADV stopped: reason 0x1
    [APP] Connected, handle: 24, role: slave, remote device: 7A:AA:E7:3D:98:A0(random)
    [APP] PHY is updated, conn_handle: 24, tx_phy: 2, rx_phy: 2
    [APP] Data len is updated, conn_handle: 24, max_tx_octets: 0x40, max_tx_time: 0x270, max_rx_octets: 0xfb, max_rx_time: 0x428
    [APP] GATTS mtu exchange successfully, mtu_size: 180, conn_handle: 24
    

BLE Central

Functional Description

BLE Central is a simple BLE central application that can scan for BLE peripherals and establish connections with them.

Supported SOCs

Ameba SOC

RTL8721Dx

RTL8726EA

RTL8720EA

RTL8713EA

RTL8730E

RTL8721F

Support State

Y

Y

Y

Y

Y

Y

Compile

    1. Enter {sdk}/amebaxxx_gcc_project directory

    1. Run the menuconfig.py command in the Windows Command Prompt or Linux terminal to enter the configuration interface as shown below:

    ../../../_images/ble_central_menuconfig.png

    Enter the CONFIG BT configuration, select Enable BT to enable the Bluetooth function, and then select BLE Central

    1. Run the build.py command in the Windows Command Prompt or Linux terminal to compile the project

Example

  • To enable the BLE Central function, use the AT command AT+BTDEMO=central,1 .

    AT+BTDEMO=central,1
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0d:c3]
    hci_phy_efuse[PEFUSE(0x741)] = 0x88
    HCI Revision is 0x000d, LMP Subversion is 0x8721.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v2
    FW Version: 20250424112906
    FW Length: 29680
    Start upper stack
    [APP] BD_ADDR: 00:E0:4C:80:0D:C3(public)
    central example enable OK!
    
    [MEM] After do cmd, available heap 261504
    
  • You can use the AT command AT+BLEGAP=scan,1 to scan for nearby Bluetooth devices. To stop scanning, use AT+BLEGAP=scan,0 .

    AT+BLEGAP=scan,1
    GAP starting scan ...
    
    [MEM] After do cmd, available heap 261440
    
    #
    [APP] Scan started, scan_type: 1
    [APP] Scan info, [Device]: 37:D9:DB:9D:1C:8A(random), AD evt type: 3, RSSI: -82, len: 31
    [APP] Scan info, [Device]: 73:46:2E:8A:AB:44(random), AD evt type: 0, RSSI: -86, len: 17
    [APP] Scan info, [Device]: 26:10:07:5E:50:BD(random), AD evt type: 3, RSSI: -78, len: 31
    [APP] Scan info, [Device]: 7D:CC:83:EF:4A:A3(random), AD evt type: 0, RSSI: -76, len: 19
    [APP] Scan info, [Device]: 7D:CC:83:EF:4A:A3(random), AD evt type: 4, RSSI: -76, len: 0
    [APP] Scan info, [Device]: 74:70:08:EE:5B:FA(random), AD evt type: 0, RSSI: -80, len: 23
    [APP] Scan info, [Device]: 39:B5:F6:BA:01:40(random), AD evt type: 3, RSSI: -60, len: 31
    [APP] Scan info, [Device]: 03:BD:97:0E:DD:EB(random), AD evt type: 3, RSSI: -62, len: 31
    [APP] Scan info, [Device]: 01:7D:D2:66:88:86(random), AD evt type: 3, RSSI: -76, len: 31
    [APP] Scan info, [Device]: 50:95:28:4A:CB:3C(random), AD evt type: 3, RSSI: -66, len: 31
    [APP] Scan info, [Device]: 79:28:DE:38:4D:B0(random), AD evt type: 3, RSSI: -84, len: 31
    [APP] Scan info, [Device]: 1A:01:D8:26:86:BC(random), AD evt type: 3, RSSI: -76, len: 31
    [APP] Scan info, [Device]: 23:DB:AA:23:6E:34(random), AD evt type: 3, RSSI: -80, len: 31
    AT+BLEGAP=scan,0
    GAP stopping scan ...
    
    [MEM] After do cmd, available heap 261504
    
    #
    [APP] Scan stopped, reason: 0x0
    
  • You can use the AT+BLEGAP=conn,<addr_type>,<addr> command to initiate a connection to another Bluetooth device.

    AT+BLEGAP=conn,0,00e04c800ce9
    GAP connecting to device 00:E0:4C:80:0C:E9(public) ...
    
    [MEM] After do cmd, available heap 261344
    
    #
    [APP] Connected, handle: 16, role: master, remote device: 00:E0:4C:80:0C:E9(public)
    [APP] GATTC Profiles attach connection success, conn_handle: 16
    [APP] Bonded device, start link encryption procedure
    [APP] GATTC mtu exchange success, mtu_size: 180, conn_handle: 16
    [APP] Pairing success, conn_handle: 16
    [APP] long term key is 0x0e9a02c59d7a54b6ad94696dc7d4a83b
    [APP] Data len is updated, conn_handle: 16, max_tx_octets: 0x40, max_tx_time: 0x270, max_rx_octets: 0x40, max_rx_time: 0x270
    

BLE Scatternet

Functional Description

BLE Scatternet is a simple BLE multi-connection application that allows a device to connect to multiple BLE peripherals while also being connected by other central devices.

Supported SOCs

Ameba SOC

RTL8721Dx

RTL8726EA

RTL8720EA

RTL8713EA

RTL8730E

RTL8721F

Support State

Y

Y

Y

Y

Y

Y

Compile

    1. Enter {sdk}/amebaxxx_gcc_project directory

    1. Run the menuconfig.py command in the Windows Command Prompt or Linux terminal to enter the configuration interface as shown below:

    ../../../_images/ble_scatternet_menuconfig.png

    Enter the CONFIG BT configuration, select Enable BT to enable the Bluetooth function, then select BLE Peirpheral , BLE Central and BLE Scatternet

    1. Run the build.py command in the Windows Command Prompt or Linux terminal to compile the project.。

Example

  • To enable the BLE Scatternet function, use the AT command AT+BTDEMO=scatternet,1 .

    AT+BTDEMO=scatternet,1
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0d:c3]
    hci_phy_efuse[PEFUSE(0x741)] = 0x88
    HCI Revision is 0x000d, LMP Subversion is 0x8721.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v2
    FW Version: 20250424112906
    FW Length: 29680
    Start upper stack
    [APP] BD_ADDR: 00:E0:4C:80:0D:C3(public)
    [APP] simple ble service register succeed!
    [APP] DIS register service succeed!
    [APP] HRS register service succeed!
    [APP] BAS register service succeed!
    [APP] IAS register service succeed!
    [APP] GLS register service succeed!
    [APP] Long uuid service register succeed!
    scatternet example enable OK!
    
    [MEM] After do cmd, available heap 258496
    
    #
    [APP] ADV started: adv_type 0
    
  • BLE Scatternet functions as both a BLE Peripheral and a BLE Central. You can refer to ExampleExample for operations.

BLE Mesh Provisioner

Functional Description

BLE Mesh Provisioner is a mesh networking application that can scan for mesh devices and perform network provisioning.

Supported SOCs

Ameba SOC

RTL8721Dx

RTL8726EA

RTL8720EA

RTL8713EA

RTL8730E

RTL8721F

Support State

Y

Y

Y

Y

Y

Y

Compile

    1. Enter {sdk}/amebaxxx_gcc_project directory

    1. Run the menuconfig.py command in the Windows Command Prompt or Linux terminal to enter the configuration interface as shown below:

    ../../../_images/ble_mesh_prov_menuconfig.png

    Enter the CONFIG BT configuration, select Enable BT to enable the Bluetooth function, and then select BLE Mesh Provisioner

    1. Run the build.py command in the Windows Command Prompt or Linux terminal to compile the project.。

Example

  • To enable the BLE Mesh Provisioner function, use the AT command AT+BTDEMO=provisioner,1 .

    AT+BTDEMO=provisioner,1
    Before Enable BT
    [WLAN-A] IPS out
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0d:c3]
    hci_phy_efuse[PEFUSE(0x741)] = 0x88
    HCI Revision is 0x000d, LMP Subversion is 0x8721.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v2
    FW Version: 20250424112906
    FW Length: 29680
    Start upper stack
    [APP] BD_ADDR: 00:E0:4C:80:0D:C3(public)
    mesh provisioner example enable OK!
    
    [MEM] After do cmd, available heap 246496
    
  • Use the AT command AT+BLEMESHSTACK=dev_info,1 to discover unprovisioned devices nearby. Use AT+BLEMESHSTACK=dev_info,0 to stop the discovery.

    AT+BLEMESHSTACK=dev_info,1
    
    [MEM] After do cmd, available heap 246496
    
    #
    [APP] bt addr=0x00e04c800ce9 type=0 rssi=-30 prov=0xe90c804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c800695 type=0 rssi=-66 prov=0x9506804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c800ce9 type=0 rssi=-32 udb=0xe90c804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c800ce9 type=0 rssi=-32 prov=0xe90c804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c80099c type=0 rssi=-66 snb=0x3ecaff672f673370
    [APP] bt addr=0x00e04c80099c type=0 rssi=-66 proxy net id=0x003ecaff672f673370
    [APP] bt addr=0x00e04c800ce9 type=0 rssi=-30 udb=0xe90c804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c80099c type=0 rssi=-68 snb=0x3ecaff672f673370
    [APP] bt addr=0x00e04c800ce9 type=0 rssi=-30 prov=0xe90c804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c800695 type=0 rssi=-66 udb=0x9506804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c800695 type=0 rssi=-64 udb=0x9506804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c800695 type=0 rssi=-66 udb=0x9506804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c80099c type=0 rssi=-66 proxy net id=0x003ecaff672f673370
    [APP] bt addr=0x00e04c800ce9 type=0 rssi=-32 prov=0xe90c804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c800ce9 type=0 rssi=-32 udb=0xe90c804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c800ce9 type=0 rssi=-30 prov=0xe90c804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c80099c type=0 rssi=-66 snb=0x3ecaff672f673370
    [APP] bt addr=0x00e04c800ce9 type=0 rssi=-30 prov=0xe90c804ce000060708090a0b0c0d0e0f
    [APP] bt addr=0x00e04c80099c type=0 rssi=-66 snb=0x3ecaff672f673370
    [APP] bt addr=0x00e04c800ce9 type=0 rssi=-30 udb=0xe90c804ce000060708090a0b0c0d0e0f
    AT+BLEMESHSTACK=dev_info,0
    
    [MEM] After do cmd, available heap 246496
    
  • Use the AT command AT+BLEMESHSTACK=pbadvcon,<UUID> to establish a PB-ADV connection. Then use AT+BLEMESHSTACK=prov to complete the provisioning.

    AT+BLEMESHSTACK=pbadvcon,e90c804ce000060708090a0b0c0d0e0f
    
    [MEM] After do cmd, available heap 246336
    
    #
    [APP] PB-ADV Link Opened!
    AT+BLEMESHSTACK=prov
    
    [MEM] After do cmd, available heap 246336
    
    #
    [APP] PB-ADV Link Closed!
    [APP] Provisioning complete,unicast address:0x100
    

BLE Mesh Device

Functional Description

BLE Mesh Device is a mesh networking device application that can be scanned and provisioned by a Mesh Provisioner.

Supported SOCs

Ameba SOC

RTL8721Dx

RTL8726EA

RTL8720EA

RTL8713EA

RTL8730E

RTL8721F

Support State

Y

Y

Y

Y

Y

Y

Compile

    1. Enter {sdk}/amebaxxx_gcc_project directory

    1. Run the menuconfig.py command in the Windows Command Prompt or Linux terminal to enter the configuration interface as shown below:

    ../../../_images/ble_mesh_dev_menuconfig.png

    Enter the CONFIG BT configuration, select Enable BT to enable the Bluetooth function, and then select BLE Mesh Device

    1. Run the build.py command in the Windows Command Prompt or Linux terminal to compile the project.。

Example

  • Use the AT command AT+BTDEMO=device,1 to enable the BLE Mesh Device function.

    AT+BTDEMO=device,1
    [WLAN-A] IPS out
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0c:e9]
    hci_phy_efuse[PEFUSE(0x741)] = 0x88
    HCI Revision is 0x000d, LMP Subversion is 0x8721.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v2
    FW Version: 20250424112906
    FW Length: 29680
    Start upper stack
    [APP] Unprovisioned Device
    [APP] BD_ADDR: 00:E0:4C:80:0C:E9(public)
    mesh device example enable OK!
    
    [MEM] After do cmd, available heap 239968
    
  • The Mesh Device can be discovered and provisioned by the Provisioner.

    [APP] PB-ADV link opened
    [APP] Being Provisioned
    [APP] Provisioning complete,unicast address:0x100
    [APP] PB-ADV link closed
    

BLE Audio

Functional Description

BLE Audio is a low-power audio transmission application that can transmit audio data over Bluetooth Low Energy.

Supported SOCs

Ameba SOC

RTL8721Dx

RTL8726EA

RTL8720EA

RTL8713EA

RTL8730E

RTL8721F

Support State

N

Y

N

N

Y

N

Compile

    1. Enter {sdk}/amebaxxx_gcc_project directory

    1. Run the menuconfig.py command in the Windows Command Prompt or Linux terminal to enter the configuration interface as shown below:

    ../../../_images/ble_audio_menuconfig.png

    Enter the CONFIG BT configuration, select Enable BT to enable the Bluetooth function, select BLE Audio as well as its included options: BLE Audio Generic Demo, BLE Audio Public Broadcast Profile , BLE Audio Telephony and Media Audio Profile , BLE Audio Gaming Audio Profile

    ../../../_images/audio_framework_menuconfig.png

    Return to the previous menu, enter the CONFIG APPLICATION configuration, then go to Audio Config. Select Enable Audio Framework and select Mixer in Select Audio Interfaces .

    1. Run the build.py command in the Windows Command Prompt or Linux terminal to compile the project.。

Example

  • Use the AT command AT+BTDEMO=generic_le_audio_demo,initiator,1 to enable the BLE Audio Initiator function.

    AT+BTDEMO=generic_le_audio_demo,initiator,1
    Set cap initiator
    bt ant 0
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0e:55]
    HCI Revision is 0x000e, LMP Subversion is 0x8730.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v3
    FW Version: 20250513111223
    FW Length: 82449
    Start upper stack
    [BAP] bt_stack_bap_init
    [CAP] bt_stack_cap_init
    [CAP] bt_stack_csis_cap_init, role Set Coordinator
    [CAP] bt_stack_mcs_server_cap_init
    [CAP] bt_stack_mcs_server_init
    bt_stack_mgr_cback: bt_ready, bd_addr 00:e0:4c:80:0e:55
    [APP] BD_ADDR: 00:E0:4C:80:0E:55(public)
    [LEA STACK] bt_stack_le_audio_gen_basic_data: group index: 0, group bis number :1
    [LE Audio] Create initiator ext scan timer
    cap example enable OK!
    
    [MEM] After do cmd, available heap 1477248
    
  • Use the AT command AT+BLEBAP=broadcast_start to start broadcasting the audio stream, and use AT+BLEBAP=broadcast_stop to stop it.。

    AT+BLEBAP=broadcast_start
    [LEA STACK] Update broadcast state: IDLE prefer state:STREAMING
    [LEA STACK] Update broadcast state: CONFIGURED_STARTING prefer state:STREAMING
    BAP start successfully
    
    [MEM] After do cmd, available heap 1476416
    
    #
    [LEA STACK] Update broadcast state: CONFIGURED prefer state:STREAMING
    [LEA STACK] bt_stack_le_audio_broadcast_establish: num_bis:1, sdu_interval:10000, rtn: 2, max_sdu: 80, max_transport_latency: 10, phy:0x2, packing:0x0, framing:0x0, encryption: 0x0
    [LEA STACK] Update broadcast state: STREAMING_STARTING prefer state:STREAMING
    [LEA STACK] bt_stack_le_audio_broadcast_establish (source handle 0x60594d40) Success
    [LEA STACK] Update broadcast state: STREAMING prefer state:STREAMING
    [BAP] broadcast source streaming
    [LEA STACK] bt_stack_le_audio_add_iso_chann iso_conn_handle 0x1f, direction 1
    [LEA STACK] bt_stack_le_audio_handle_data_path_setup iso handle 0x1f, frame_num 2, dir 1, sample_frequency 0x3, audio_channel_allocation 0x00000003, presentation_delay 0x[APP] broadcast setup path indication: bis_idx: 0x1, bis_conn_handle 0x1f, cause: 0x0
    [APP] broadcast setup path indication: iso_conn_handle: 0x1f, path_direction 0x1, cause: 0x0
    [LEA STACK] app_bt_le_audio_lc3_codec_entity_add audio_channel_allocation=0x3, sample_frequency=0x3
    [BT AUDIO] BT codec try to add one codec
    [BT AUDIO] add codec type 8 !
    [BT_AUDIO] lc3 codec init
    [APP] app_bt_le_audio_cap_encode_data_control 1
    [APP] app_bt_le_audio_send_timer_update: time_interval_us=10000
    AT+BLEBAP=broadcast_stop
    [LEA STACK] Update broadcast state: STREAMING prefer state:IDLE
    [APP] broadcast remove path indication: bis_conn_handle 0x1f, cause: 0x0
    [LEA STACK] Update broadcast state: STREAMING_STOPPING prefer state:IDLE
    [APP] app_bt_le_audio_cap_encode_data_control 0
    BAP stop successfully
    
    [MEM] After do cmd, available heap 1424832
    [BT_AUDIO] lc3 codec deinit
    

BT A2DP

Functional Description

BT A2DP is an audio streaming application that allows audio data to be transmitted over Bluetooth.

Supported SOCs

Ameba SOC

RTL8721Dx

RTL8726EA

RTL8720EA

RTL8713EA

RTL8730E

RTL8721F

Support State

N

Y

N

Y

Y

N

Compile

    1. Enter {sdk}/amebaxxx_gcc_project directory

    1. Run the menuconfig.py command in the Windows Command Prompt or Linux terminal to enter the configuration interface as shown below:

    ../../../_images/bt_a2dp_menuconfig.png

    Enter the CONFIG BT configuration, select Enable BT to enable the Bluetooth function, and then select BT A2DP

    ../../../_images/audio_framework_menuconfig.png

    Return to the previous menu, enter the CONFIG APPLICATION configuration, then go to Audio Config. Select Enable Audio Framework and select Mixer in Select Audio Interfaces .

    1. Run the build.py command in the Windows Command Prompt or Linux terminal to compile the project.。

Example

  • Use the AT command AT+BTDEMO=a2dp,snk,1 to enable the A2DP sink function.

    AT+BTDEMO=a2dp,snk,1
    Set a2dp role (snk)
    bt ant 0
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0e:55]
    HCI Revision is 0x000e, LMP Subversion is 0x8730.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v3
    FW Version: 20250513111223
    FW Length: 82449
    Start upper stack
    [AVRCP]app_avrcp_init
    [A2DP]app_a2dp_init
    [SDP]app_sdp_init
    bt_stack_mgr_cback: bt_ready, bd_addr 00:e0:4c:80:0e:55
    [APP] BD_ADDR: 00:E0:4C:80:0E:55
    [A2DP Demo] Create auto reaconnect timer
    [A2DP Demo] Load a2dp demo reconnect data success
    [A2DP Demo] Load a2dp demo bond info table success
    [A2DP Demo] Bond Info List
    >> 1.  mac addr 00:e0:4c:80:0e:56   name  RTK_BT_CONCURRENT_DEV(0E56)
    >> 2.  mac addr 00:e0:4c:80:07:19   name  RTK_BT_CONCURRENT_DEV(0719)
    [A2DP Demo] Create bond info flush thread
    a2dp example enable OK!
    
    [MEM] After do cmd, available heap 1939392
    
  • The A2DP sink device can be discovered by a mobile phone, allowing the phone to connect and play music through it.

    [BR GAP] ACL connection indication dc:b5:4f:83:db:46
    bt_stack_mgr_cback: link alloc success, hadnle 0x1
    [A2DP Demo] Save a2dp demo reconnect data success
    [BR GAP] ACL connection success dc:b5:4f:83:db:46
    bt_stack_mgr_cback: BT_EVENT_LINK_KEY_INFO
    [BR GAP] Set link key of dc:b5:4f:83:db:46
    [A2DP Demo] Get Bond Number 3
    [A2DP Demo] Get Bond addr dc:b5:4f:83:db:46
    [A2DP Demo] Get Bond addr 00:e0:4c:80:0e:56
    [A2DP Demo] Get Bond addr 00:e0:4c:80:07:19
    [A2DP Demo] Save a2dp demo bond info table success
    bt_stack_mgr_cback: BT_EVENT_REMOTE_NAME_RSP
    [A2DP Demo] Save a2dp demo bond info table success
    [A2DP Demo] Bond Info List
    >> 1.  mac addr dc:b5:4f:83:db:46   name  ZC???iPhone
    >> 2.  mac addr 00:e0:4c:80:0e:56   name  RTK_BT_CONCURRENT_DEV(0E56)
    >> 3.  mac addr 00:e0:4c:80:07:19   name  RTK_BT_CONCURRENT_DEV(0719)
    app_a2dp_bt_cback: A2DP p_link confirmed
    [A2DP] Receive A2DP connection from dc:b5:4f:83:db:46
    app_a2dp_bt_cback: A2DP Connected
    [A2DP] A2DP connection completion with dc:b5:4f:83:db:46
    app_avrcp_bt_cback: T_EVENT_AVRCP_CONN_IND
    [AVRCP] Receive AVRCP connection from dc:b5:4f:83:db:46
    app_avrcp_bt_cback: BT_EVENT_AVRCP_CONN_CMPL
    [AVRCP] Connection Completion
    [AVRCP] AVRCP connection completion with dc:b5:4f:83:db:46
    app_a2dp_bt_cback: A2DP config: SBC
    [BT AUDIO] Audio Framework Mixer try to add one audio track
    [BT AUDIO] audio track init audio channels 2, rate 44100, format 2, left_volume [BT AUDIO] pcm data callback is NULL
    => I/AudioHal:[CreateAudioHwStreamOut]: startAudioHwStreamOut samplerate:44100, format:2, channel:2, framesize:4, period_size:1024
    [AmpDummy-I] ++Create
    [Mixer-I] RawMixer init time_freq_
    [OsalThread-W] [OsalThreadCreateEx] warn: set stack size to default 16384
    rtk_bt_audio_track_init get start threshold:24576
    rtk_bt_audio_track_init sample_rate 44100, channel_count 2, track_buf_size 24576
    [BT AUDIO] Complete allocating audio track
    [BT AUDIO] BT codec try to add one codec
    [BT AUDIO] add codec type 1 !
    [BT_AUDIO] sbc codec init
    [A2DP] Configure Complete CODEC 1
    app_avrcp_bt_cback: BT_EVENT_AVRCP_REG_VOLUME_CHANGED
    => I/AudioHal:[ameba_audio_ctl_set_tx_volume]: set dacl volume to 0x6f
    => I/AudioHal:[ameba_audio_ctl_set_tx_volume]: set dacr volume to 0x6f
    [AVRCP] volume request set 78
    app_avrcp_bt_cback: BT_EVENT_AVRCP_PLAY_STATUS_CHANGED
    [AVRCP]: Paused
    app_a2dp_bt_cback: A2DP STREAM is opened
    [A2DP] A2DP STREAM is opened
    [A2DP] A2DP stream open with dc:b5:4f:83:db:46
    [A2DP] A2DP stream open max packet length is 991
    app_avrcp_bt_cback: BT_EVENT_AVRCP_ABSOLUTE_VOLUME_SET
    => I/AudioHal:[ameba_audio_ctl_set_tx_volume]: set dacl volume to 0x2a
    => I/AudioHal:[ameba_audio_ctl_set_tx_volume]: set dacr volume to 0x2a
    [AVRCP] absolute volume set 29
    app_avrcp_bt_cback: BT_EVENT_AVRCP_ABSOLUTE_VOLUME_SET
    [AVRCP] absolute volume set 29
    app_avrcp_bt_cback: BT_EVENT_AVRCP_ABSOLUTE_VOLUME_SET
    [AVRCP] absolute volume set 29
    app_avrcp_bt_cback: BT_EVENT_AVRCP_ABSOLUTE_VOLUME_SET
    [AVRCP] absolute volume set 29
    app_avrcp_bt_cback: BT_EVENT_AVRCP_ABSOLUTE_VOLUME_SET
    [AVRCP] absolute volume set 29
    app_avrcp_bt_cback: BT_EVENT_AVRCP_ABSOLUTE_VOLUME_SET
    [AVRCP] absolute volume set 29
    app_a2dp_bt_cback: BT_EVENT_A2DP_STREAM_START_IND active_a2dp_idx 0, streaming_fg 1
    [A2DP] BT_EVENT_A2DP_STREAM_START_IND active_a2dp_idx 0, streaming_fg 1
    app_avrcp_bt_cback: BT_EVENT_AVRCP_PLAY_STATUS_CHANGED
    [AVRCP]: Playing
    
  • Use the AT command AT+BTDEMO=a2dp,src,1 to enable the A2DP source function.

    AT+BTDEMO=a2dp,src,1
    Set a2dp role (src)
    bt ant 1
    [WLAN-A] IPS out
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0e:41]
    HCI Revision is 0x000e, LMP Subversion is 0x8730.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v3
    FW Version: 20250513111223
    FW Length: 82449
    Start upper stack
    [AVRCP]app_avrcp_init
    [A2DP]app_a2dp_init
    [SDP]app_sdp_init
    bt_stack_mgr_cback: bt_ready, bd_addr 00:e0:4c:80:0e:41
    [APP] BD_ADDR: 00:E0:4C:80:0E:41
    [A2DP Demo] Create auto reaconnect timer
    [A2DP Demo] Fail to load a2dp reconnect data
    [A2DP Demo] Fail to load a2dp bond table
    [A2DP Demo] Create bond info flush thread
    a2dp example enable OK!
    
    [MEM] After do cmd, available heap 1939264
    
  • On the A2DP source side, use the AT command AT+BTA2DP=conn,<addr> to establish a connection with the A2DP sink device. After that, you can use AT+BTA2DP=start,<addr> to start music playback.

    AT+BTA2DP=conn,00e04c800e55
    A2DP connecting to device 00:E0:4C:80:0E:55 ...
    
    [MEM] After do cmd, available heap 1939392
    
    #
    bt_stack_mgr_cback: link alloc success, hadnle 0x1
    [A2DP Demo] Save a2dp demo reconnect data success
    [BR GAP] ACL connection success 00:e0:4c:80:0e:55
    [A2DP] SDP Scan 00:e0:4c:80:0e:55
    bt_stack_mgr_cback: BT_EVENT_LINK_KEY_REQ
    [BR GAP] Link Key Request received and found is 0x0
    bt_stack_mgr_cback: BT_EVENT_LINK_KEY_INFO
    [BR GAP] Set link key of 00:e0:4c:80:0e:55
    [A2DP Demo] Get Bond Number 1
    [A2DP Demo] Get Bond addr 00:e0:4c:80:0e:55
    [A2DP Demo] Save a2dp demo bond info table success
    bt_stack_mgr_cback: BT_EVENT_REMOTE_NAME_RSP
    [A2DP Demo] Save a2dp demo bond info table success
    [A2DP Demo] Bond Info List
    >> 1.  mac addr 00:e0:4c:80:0e:55   name  RTK_BT_AUDIO_DEVICE(0E55)
    app_a2dp_bt_cback: A2DP Connected
    [A2DP] A2DP connection completion with 00:e0:4c:80:0e:55
    app_avrcp_bt_cback: BT_EVENT_AVRCP_CONN_CMPL
    [AVRCP] Connection Completion
    [AVRCP] AVRCP connection completion with 00:e0:4c:80:0e:55
    app_avrcp_bt_cback: BT_EVENT_AVRCP_PLAY_STATUS_CHANGED_REG_REQ
    app_a2dp_bt_cback: A2DP config: SBC
    [BT AUDIO] BT codec try to add one codec
    [BT AUDIO] add codec type 1 !
    [BT_AUDIO] sbc codec init
    [A2DP] Configure Complete CODEC 1
    app_avrcp_bt_cback: BT_EVENT_AVRCP_VOLUME_CHANGED
    [AVRCP] Volume changed 100
    app_a2dp_bt_cback: A2DP STREAM is opened
    [A2DP] A2DP STREAM is opened
    [A2DP] A2DP stream open with 00:e0:4c:80:0e:55
    [A2DP] A2DP stream open max packet length is 661
    
    AT+BTA2DP=start,00e04c800e55
    A2DP starting to device 00:E0:4C:80:0E:55 ...
    
    [MEM] After do cmd, available heap 1927744
    
    #
    bt_stack_mgr_cback: BT_EVENT_ACL_CONN_ACTIVE
    [BR GAP] ACL active 00:e0:4c:80:0e:55
    [A2DP] BT_EVENT_A2DP_STREAM_START_IND active_a2dp_idx 0, streaming_fg 0
    [A2DP Demo] Create Test Demo
    app_avrcp_bt_cback: BT_EVENT_AVRCP_PLAY_STATUS_CHANGED_REG_REQ
    

BT HFP

Functional Description

BT HFP (Hands-Free Profile) is a hands-free telephony application that enables audio data transmission and call control functions over Bluetooth.

Supported SOCs

Ameba SOC

RTL8721Dx

RTL8726EA

RTL8720EA

RTL8713EA

RTL8730E

RTL8721F

Support State

N

Y

N

Y

Y

N

Compile

    1. Enter {sdk}/amebaxxx_gcc_project directory

    1. Run the menuconfig.py command in the Windows Command Prompt or Linux terminal to enter the configuration interface as shown below:

    ../../../_images/bt_hfp_menuconfig.png

    Enter the CONFIG BT configuration, select Enable BT to enable the Bluetooth function, and then select BT HFP

    Return to the previous menu, enter the CONFIG APPLICATION configuration, then go to Audio Config. Select Enable Audio Framework and select Mixer in Select Audio Interfaces .

    1. Run the build.py command in the Windows Command Prompt or Linux terminal to compile the project.。

Example

  • Use the AT command AT+BTDEMO=hfp,ag,1 to enable the HFP AG (Audio Gateway) function.

    AT+BTDEMO=hfp,ag,1
    Set hfp role (audio gate)
    bt ant 0
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0e:55]
    HCI Revision is 0x000e, LMP Subversion is 0x8730.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v3
    FW Version: 20250513111223
    FW Length: 82449
    Start upper stack
    [SDP]app_sdp_init
    [HFP]app_hfp_init
    bt_stack_mgr_cback: bt_ready, bd_addr 00:e0:4c:80:0e:55
    [APP] BD_ADDR: 00:E0:4C:80:0E:55
    hfp example enable OK!
    
    [MEM] After do cmd, available heap 1968576
    
  • Use the AT command AT+BTHFP=conn,<addr> to establish a connection with the HFP HF (Hands-Free) device. Then, use AT+BTHFP=conn_income,<addr>,<phone_number>,0 to make a call to the HF device.

    AT+BTHFP=conn,00e04c800e41
    HFP connecting to device 00:E0:4C:80:0E:41 ...
    
    [MEM] After do cmd, available heap 1968576
    
    #
    bt_stack_mgr_cback: link alloc success, hadnle 0x1
    [BR GAP] ACL connection success 00:e0:4c:80:0e:41
    [HFP] SDP Scan 00:e0:4c:80:0e:41
    bt_stack_mgr_cback: BT_EVENT_LINK_KEY_REQ
    br_gap_app_callback, Unknown GAP RTK_BLE_EVT: 8
    app_hfp_bt_cback: BT_EVENT_HFP_AG_INDICATORS_STATUS_REQ
    [HFP] Receive AG indicators req from 00:e0:4c:80:0e:41
    app_hfp_bt_cback: BT_EVENT_HFP_AG_CONN_CMPL
    [HFP] Receive AG connection completion from 00:e0:4c:80:0e:41
    bt_stack_mgr_cback: BT_EVENT_ACL_CONN_SNIFF
    [BR GAP] ACL sniff mode from 00:e0:4c:80:0e:41
    [BR GAP] ACL sniff interval 0x330
    AT+BTHFP=call_income,00e04c800e41,10086,0
    app_hfp_bt_cback: BT_EVENT_HFP_AG_CALL_STATUS_CHANGED
    [HFP] Receive AG call status change from 0 to 1 from 00:e0:4c:80:0e:41
    HFP call income to device 00:E0:4C:80:0E:41 ... number is 10086 length is 5 type is 0
    
    [MEM] After do cmd, available heap 1966016
    
  • Use the AT command AT+BTDEMO=hfp,hf,1 to enable the HFP HF (Hands-Free) function.

    AT+BTDEMO=hfp,hf,1
    Set hfp role (hand free)
    bt ant 1
    [WLAN-A] IPS out
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0e:41]
    HCI Revision is 0x000e, LMP Subversion is 0x8730.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v3
    FW Version: 20250513111223
    FW Length: 82449
    Start upper stack
    [SDP]app_sdp_init
    [HFP]app_hfp_init
    [PBAP]app_pbap_init
    bt_stack_mgr_cback: bt_ready, bd_addr 00:e0:4c:80:0e:41
    [APP] BD_ADDR: 00:E0:4C:80:0E:41
    hfp example enable OK!
    
    [MEM] After do cmd, available heap 1967040
    
  • When connected by the AG (Audio Gateway) and receiving an incoming call from the AG device, you can use the AT command AT+BTHFP=conn_answer,<addr> to answer the call, and AT+BTHFP=conn_terminate,<addr> to hang up the call.

    AT+BTHFP=call_answer,00e04c800e55
    HFP call answer req to device 00:E0:4C:80:0E:55 ...
    
    [MEM] After do cmd, available heap 1871680
    
    #
    app_hfp_bt_cback: BT_EVENT_HFP_CALL_STATUS
    [HFP] Receive HFP call status change from 1 to 3 from 00:e0:4c:80:0e:55
    [HFP] ring alert outband inactive
    [GenTrack-I] time(608735964) track(0)
    [GenTrack-I] time(608736206) track(0)
    app_hfp_bt_cback: BT_EVENT_SCO_CONN_IND
    [HFP] Receive HFP SCO connection from 00:e0:4c:80:0e:55
    AT+BTHFP=call_terminate,00e04c800e55
    HFP call terminate req to device 00:E0:4C:80:0E:55 ...
    
    [MEM] After do cmd, available heap 1907072
    
    #
    app_hfp_bt_cback: BT_EVENT_HFP_CALL_STATUS
    [HFP] Receive HFP call status change from 3 to 0 from 00:e0:4c:80:0e:55
    

BT SPP

Functional Description

BT SPP is a serial communication application that can transmit serial data over Bluetooth.

Supported SOCs

Ameba SOC

RTL8721Dx

RTL8726EA

RTL8720EA

RTL8713EA

RTL8730E

RTL8721F

Support State

N

Y

N

Y

Y

N

Compile

    1. Enter {sdk}/amebaxxx_gcc_project directory

    1. Run the menuconfig.py command in the Windows Command Prompt or Linux terminal to enter the configuration interface as shown below:

    ../../../_images/bt_spp_menuconfig.png

    Enter the CONFIG BT configuration, select Enable BT to enable the Bluetooth function, and then select BT SPP

    1. Run the build.py command in the Windows Command Prompt or Linux terminal to compile the project.。

Example

  • Use the AT command AT+BTDEMO=spp,client,1 to enable the SPP client function.

    AT+BTDEMO=spp,client,1
    Set spp role (client)
    [APP] spp demo role : SPP Client
    bt ant 0
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0e:55]
    HCI Revision is 0x000e, LMP Subversion is 0x8730.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v3
    FW Version: 20250513111223
    FW Length: 82449
    Start upper stack
    bt_stack_spp_init
    [SDP]app_sdp_init
    bt_stack_mgr_cback: bt_ready, bd_addr 00:e0:4c:80:0e:55
    [APP] BD_ADDR: 00:E0:4C:80:0E:55
    spp example enable OK!
    
    [MEM] After do cmd, available heap 2380608
    
  • You can use the mobile app “Bluetooth SPP Tool” to scan for and establish a connection with the SPP client.

    [SPP] SPP connection completion with dc: ee: 6: 6c: d: 55, server channel: 0x3 , frame size: 990, link credit: 7
    
  • Use the AT command AT+BTDEMO=spp,server,1 to enable the SPP server function.

    AT+BTDEMO=spp,server,1
    Set spp role (server)
    [APP] spp demo role : SPP Server
    bt ant 0
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0e:55]
    HCI Revision is 0x000e, LMP Subversion is 0x8730.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v3
    FW Version: 20250513111223
    FW Length: 82449
    Start upper stack
    bt_stack_spp_init
    [SDP]app_sdp_init
    bt_stack_mgr_cback: bt_ready, bd_addr 00:e0:4c:80:0e:55
    [APP] BD_ADDR: 00:E0:4C:80:0E:55
    [APP] SPP server start inquiry...
    [APP] Start inquiry success
    spp example enable OK!
    
    [MEM] After do cmd, available heap 2380608
    
  • On the SPP server side, you can use the AT command AT+BTSPP=conn,<addr> to establish a connection with the SPP client.

    AT+BTSPP=conn,00e04c800e55
    [bt_stack_spp_connect] SPP server stop inquiry failed!
    [bt_stack_spp_connect] SPP server start sdp discov success!
    SPP connecting to device 00:E0:4C:80:0E:55 ...
    
    [MEM] After do cmd, available heap 2380672
    
    #
    bt_stack_mgr_cback: link alloc success, hadnle 0x2
    [BR GAP] ACL connection success 00:e0:4c:80:0e:55
    bt_stack_spp_evt_ind_cback: BT_EVENT_SDP_ATTR_INFO The uuid is registered and the local server channel is bonded
    bt_stack_spp_evt_ind_cback: local server channel is 0x3, remote server channel is 0x3
    [SPP] SPP sdp attr info from 00:e0:4c:80:0e:55
    [SPP] UUID type is uuid16
    [SPP] uuid16 is : 0x1101
    bt_stack_spp_evt_ind_cback: BT_EVENT_SDP_ATTR_INFO The uuid is registered and the local server channel is bonded
    bt_stack_spp_evt_ind_cback: local server channel is 0x4, remote server channel is 0x4
    [SPP] SPP sdp attr info from 00:e0:4c:80:0e:55
    [SPP] UUID type is uuid128
    [SPP] uuid128 is : 6a 24 ee ab 4b 65 46 93 98 6b 3c 26 c3 52 26 4f
    bt_stack_spp_evt_ind_cback: BT_EVENT_SDP_DISCOV_CMPL SDP Discovery Completely
    bt_stack_spp_evt_ind_cback: BT_EVENT_SDP_DISCOV_CMPL send spp connection request success
    bt_stack_spp_evt_ind_cback: BT_EVENT_SDP_DISCOV_CMPL SDP Discovery Completely
    [SPP] SPP sdp discov cmpl from 00:e0:4c:80:0e:55
    bt_stack_spp_evt_ind_cback: BT_EVENT_SDP_DISCOV_CMPL send spp connection request success
    [SPP] SPP sdp discov cmpl from 00:e0:4c:80:0e:55
    bt_stack_mgr_cback: BT_EVENT_LINK_KEY_REQ
    br_gap_app_callback, Unknown RTK_BT_BR_GAP_EVT: 8
    [SPP] SPP connection completion with 00:e0:4c:80:0e:55, server channel: 0x3, frame size: 244, link credit: 7
    [SPP] SPP TX test to 00:e0:4c:80:0e:55, server channel: 0x3
    bt_stack_spp_send_data: link credit is 6
    [SPP] Send SPP tx test data success
    [SPP] SPP connection completion with 00:e0:4c:80:0e:55, server channel: 0x4, frame size: 244, link credit: 7
    [SPP] SPP TX test to 00:e0:4c:80:0e:55, server channel: 0x4
    bt_stack_spp_send_data: link credit is 6
    [SPP] Send SPP tx test data success
    

BT Specialized Application

BLE WiFiMate

Functional Description

BLE WiFiMate is a simple Bluetooth provisioning application that allows devices to connect to a WiFi network via Bluetooth provisioning.

Supported SOCs

Ameba SOC

RTL8721Dx

RTL8726EA

RTL8720EA

RTL8713EA

RTL8730E

Support State

Y

Y

Y

Y

Y

Compile

    1. Enter {sdk}/amebaxxx_gcc_project directory

    1. Run the menuconfig.py command in the Windows Command Prompt or Linux terminal to enter the configuration interface as shown below:

    ../../../_images/ble_wifimate_menuconfig.png

    Enter the CONFIG BT configuration, select Enable BT to enable the Bluetooth function, and also select BLE WiFiMate Device and BLE WiFiMate Configurator .

    1. Run the build.py command in the Windows Command Prompt or Linux terminal to compile the project.

Example

  • To enable the WiFiMate Configurator function, use the AT command AT+BTDEMO=ble_wifimate_configurator,1 .

    AT+BTDEMO=hfp,ag,1
    Set hfp role (audio gate)
    bt ant 0
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0e:55]
    HCI Revision is 0x000e, LMP Subversion is 0x8730.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v3
    FW Version: 20250513111223
    FW Length: 82449
    Start upper stack
    [SDP]app_sdp_init
    [HFP]app_hfp_init
    bt_stack_mgr_cback: bt_ready, bd_addr 00:e0:4c:80:0e:55
    [APP] BD_ADDR: 00:E0:4C:80:0E:55
    hfp example enable OK!
    
    [MEM] After do cmd, available heap 1968576
    
  • To establish a connection with the WiFiMate Device, use the AT command AT+BLEGAP=conn,0,<addr> . After the connection is established, you can use the command AT+BTDEMO=ble_wifimate_configurator,wifi_scan,<conn_handle> to instruct the Device to perform a WiFi scan.

    AT+BLEGAP=conn,0,00e04c800e41
    GAP connecting to device 00:E0:4C:80:0E:41(public) ...
    
    [MEM] After do cmd, available heap 2334400
    
    #
    [APP] Connected, handle: 16, role: master, remote device: 00:E0:4C:80:0E:41(public)
    [APP] BLE wifimate client set encrypt success.
    [APP] BLE wifimate client attach connection success, conn_handle: 16
    [APP] GATTC mtu exchange success, mtu_size: 512, conn_handle: 16
    [APP] GATTC discover primary by uuid result: start_handle: 0x0012, end_handle: 0x001e
    [APP] GATTC discover completed. profile_id: 8, conn_handle: 16, type: 1
    [APP] GATTC discover characteristic of a service result: handle: 0x0013, properties: 0x08(write_req), value_handle: 0x0014, UUID: d020
    [APP] GATTC discover characteristic of a service result: handle: 0x0015, properties: 0x08(write_req), value_handle: 0x0016, UUID: d021
    [APP] GATTC discover characteristic of a service result: handle: 0x0017, properties: 0x20(indicate), value_handle: 0x0018, UUID: d022
    [APP] GATTC discover characteristic of a service result: handle: 0x001a, properties: 0x08(write_req), value_handle: 0x001b, UUID: d023
    [APP] GATTC discover characteristic of a service result: handle: 0x001c, properties: 0x20(indicate), value_handle: 0x001d, UUID: d024
    [APP] GATTC discover completed. profile_id: 8, conn_handle: 16, type: 3
    [APP] GATTC discover descriptor all result: handle: 0x0014, UUID: d020
    [APP] GATTC discover descriptor all result: handle: 0x0015, UUID: 2803
    [APP] GATTC discover descriptor all result: handle: 0x0016, UUID: d021
    [APP] GATTC discover descriptor all result: handle: 0x0017, UUID: 2803
    [APP] GATTC discover descriptor all result: handle: 0x0018, UUID: d022
    [APP] GATTC discover descriptor all result: handle: 0x0019, UUID: 2902
    [APP] GATTC discover descriptor all result: handle: 0x001a, UUID: 2803
    [APP] GATTC discover descriptor all result: handle: 0x001b, UUID: d023
    [APP] GATTC discover descriptor all result: handle: 0x001c, UUID: 2803
    [APP] GATTC discover descriptor all result: handle: 0x001d, UUID: d024
    [APP] GATTC discover descriptor all result: handle: 0x001e, UUID: 2902
    [APP] BLE WiFiMate client discover all success
    [APP] GATTC discover completed. profile_id: 8, conn_handle: 16, type: 5
    [APP] BLE WiFiMate client negotiate key: algo_type(0)                             key(00-00-00-00-00-00-00-00-00-00-00-00-00)...
    [APP] BLE WiFiMate client write charac negotiate key success
    AT+BTDEMO=ble_wifimate_configurator,wifi_scan,16
    
    [MEM] After do cmd, available heap 2333376
    
    #
    [APP] BLE WiFiMate client write charac wifi scan enable success
    [APP] BLE WiFiMate wifi scan info checksum pass!
    [APP] WiFi scan info: ssid=zzy_test, rssi=-9, security=12, channel=7
    [APP] WiFi scan info: ssid=test_ap_2.4G, rssi=-12, security=12, channel=6
    [APP] WiFi scan info: ssid=BT2SD2, rssi=-17, security=10, channel=11
    [APP] WiFi scan info: ssid=ats_test, rssi=-27, security=7, channel=7
    [APP] WiFi scan info: ssid=wn_lg_24_7, rssi=-27, security=10, channel=7
    [APP] WiFi scan info: ssid=iteAP, rssi=-29, security=14, channel=4
    [APP] WiFi scan info: ssid=TP-LINK_F18B, rssi=-29, security=14, channel=6
    [APP] WiFi scan info: ssid=CMCC-2X9d, rssi=-29, security=10, channel=11
    [APP] WiFi scan info: ssid=, rssi=-29, security=10, channel=11
    [APP] WiFi scan info: ssid=TP-LINK_1524, rssi=-30, security=10, channel=1
    [APP] WiFi scan info: ssid=, rssi=-30, security=10, channel=1
    [APP] WiFi scan info: ssid=James_TP, rssi=-30, security=10, channel=6
    [APP] WiFi scan info: ssid=WN_BT, rssi=-31, security=10, channel=11
    [APP] WiFi scan info: ssid=AXE11000-2.4G, rssi=-32, security=0, channel=6
    [APP] WiFi scan info: ssid=, rssi=-32, security=10, channel=11
    [APP] WiFi scan info: ssid=WN_LG2, rssi=-34, security=10, channel=6
    [APP] WiFi scan info: ssid=qwer, rssi=-34, security=0, channel=7
    [APP] WiFi scan info: ssid=lll, rssi=-35, security=14, channel=4
    [APP] WiFi scan info: ssid=Xiaomi_04E0, rssi=-35, security=12, channel=4
    [APP] WiFi scan info: ssid=, rssi=-35, security=10, channel=6
    [APP] WiFi scan info: ssid=ChinaNet-sgte, rssi=-37, security=7, channel=1
    [APP] WiFi scan info: ssid=@Ruijie-sC737, rssi=-40, security=10, channel=12
    [APP] WiFi scan info: ssid=test_ap_5G, rssi=-48, security=14, channel=161
    [APP] WiFi scan info: ssid=HONOR, rssi=-49, security=7, channel=1
    [APP] WiFi scan info: ssid=ats_test_5g, rssi=-50, security=14, channel=153
    [APP] WiFi scan info: ssid=zzy_test_5g, rssi=-54, security=11, channel=60
    [APP] WiFi scan info: ssid=ASUS_00_2G, rssi=-56, security=7, channel=11
    [APP] WiFi scan info: ssid=wn_lg_5g, rssi=-56, security=10, channel=36
    [APP] WiFi scan info: ssid=TP-LINK_1524, rssi=-56, security=10, channel=48
    [APP] WiFi scan info: ssid=, rssi=-56, security=10, channel=48
    [APP] WiFi scan info: ssid=TP-LINK_CTS, rssi=-57, security=10, channel=11
    [APP] WiFi scan info: ssid=@Ruijie-sC737_5G, rssi=-57, security=14, channel=149
    [APP] WiFi scan info: ssid=, rssi=-60, security=10, channel=11
    [APP] WiFi scan info: ssid=wwwww, rssi=-60, security=7, channel=149
    [APP] WiFi scan info: ssid=WN_BT, rssi=-62, security=10, channel=44
    [APP] WiFi scan info: ssid=, rssi=-63, security=10, channel=44
    [APP] WiFi scan info: ssid=TP-LINK_5G_F18B, rssi=-64, security=14, channel=149
    [APP] WiFi scan info: ssid=, rssi=-64, security=10, channel=149
    [APP] WiFi scan info: ssid=CMCC-U25Z, rssi=-65, security=10, channel=153
    [APP] WiFi scan info: ssid=, rssi=-65, security=10, channel=153
    [APP] WiFi scan info: ssid=RealOffice, rssi=-66, security=7, channel=157
    [APP] WiFi scan info: ssid=RealGuest, rssi=-67, security=7, channel=157
    [APP] WiFi scan info: ssid=OT-2Q5K, rssi=-68, security=10, channel=48
    [APP] WiFi scan info: ssid=ASUS_00_5G, rssi=-68, security=12, channel=149
    [APP] WiFi scan info: ssid=, rssi=-69, security=10, channel=48
    [APP] WiFi scan info: ssid=WN_BT, rssi=-69, security=10, channel=153
    [APP] WiFi scan info: ssid=, rssi=-69, security=10, channel=153
    [APP] WiFi scan info: ssid=Xiaomi_04E0_5G, rssi=-69, security=12, channel=153
    [APP] WiFi scan info: ssid=, rssi=-69, security=7, channel=153
    [APP] WiFi scan info: ssid=RealOffice, rssi=-70, security=7, channel=40
    [APP] WiFi scan info: ssid=RealGuest, rssi=-70, security=7, channel=40
    [APP] WiFi scan info: ssid=RealGuest, rssi=-71, security=7, channel=161
    [APP] WiFi scan info: ssid=HONOR_5G, rssi=-72, security=14, channel=44
    [APP] WiFi scan info: ssid=TP-LINK_CTS, rssi=-72, security=10, channel=149
    [APP] WiFi scan info: ssid=, rssi=-72, security=10, channel=149
    [APP] WiFi scan info: ssid=Biubiubiu_5G, rssi=-76, security=11, channel=157
    [APP] WiFi scan info: ssid=RealOffice, rssi=-79, security=7, channel=40
    [APP] WiFi scan info: ssid=RealGuest, rssi=-79, security=7, channel=40
    [APP] WiFi scan info: ssid=ChinaNet-sgte, rssi=-80, security=7, channel=149
    [APP] WiFi scan info: ssid=TP-LINK_Demo, rssi=-81, security=10, channel=153
    [APP] WiFi scan info: ssid=RealOffice, rssi=-82, security=7, channel=56
    [APP] WiFi scan info: ssid=, rssi=-82, security=10, channel=153
    [APP] WiFi scan info: ssid=NICLab-R7000-5G, rssi=-82, security=7, channel=161
    [APP] WiFi scan info: ssid=, rssi=-84, security=7, channel=153
    [APP] BLE WiFiMate wifi scan num=64
    
  • Next, use the AT command AT+BTDEMO=ble_wifimate_configurator,wifi_connect,<conn_handle>,<ssid>,<security>,<password> to provision the network for the Device.

    AT+BTDEMO=ble_wifimate_configurator,wifi_connect,16,test_ap_2.4G,12,12345678
    [AT+BTDEMO] BLE wifimate configurator conn_handle=16, ssid_len=12, ssid=test_ap_2.4G, security=12, password_len=8, password=12345678
    
    [MEM] After do cmd, available heap 2333312
    
    #
    [APP] BLE WiFiMate Client conn_handle=16, wifi_state=1, err_code=0
    [APP] Disconnected, reason: 0x113, handle: 16, role: master, remote device: 00:E0:4C:80:0E:41(public)
    [APP] GATTC Profiles detach connection success, conn_handle: 16
    
  • To enable the WiFiMate Configurator function, use the AT command AT+BTDEMO=ble_wifimate_configurator,1 .

    AT+BTDEMO=ble_wifimate_device,1
    bt ant 1
    [WLAN-A] IPS out
    Bluetooth init BT_ADDR in cfgbuf [00:e0:4c:80:0e:41]
    HCI Revision is 0x000e, LMP Subversion is 0x8730.
    Set baudrate to 3000000 success!
    Signature check success: Merge patch v3
    FW Version: 20250513111223
    FW Length: 82449
    Start upper stack
    bt_stack_mgr_cback: bt_ready, bd_addr 00:e0:4c:80:0e:41
    [APP] BD_ADDR: 00:E0:4C:80:0E:41(public)
    [APP] BLE WiFiMate service register succeed!
    Ble wifimate device example enable OK!
    
    [MEM] After do cmd, available heap 2333760
    
    #
    [APP] ADV started: adv_type 0