mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
2.6 KiB
2.6 KiB
| Supported Targets | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H4 | ESP32-S31 |
|---|
ESP-IDF PAwR Synchronizer Example
This example demonstrates Periodic Advertising with Responses (PAwR) on the synchronizer side.
- The device performs extended scanning and creates periodic sync to the advertiser.
- After sync is established, it selects a list of subevents to synchronize to via
esp_ble_gap_set_periodic_sync_subevent(). - For received subevents, it sends responses via
esp_ble_gap_set_periodic_adv_response_data(). - The response data includes the synchronizer's BLE address, allowing the advertiser to establish a connection.
- The device acts as a GATTS server with a service table, ready to accept connections from the advertiser.
How to Use
Pairing Test: Synchronizer + Advertiser
This example should be paired with ble_pawr_advertiser or ble_pawr_advertiser_conn for testing.
Test Setup:
- Device A (Advertiser): Flash
ble_pawr_advertiserorble_pawr_advertiser_connexample - Device B (Synchronizer): Flash this
ble_pawr_synchronizerexample
Steps:
-
Build and flash advertiser example to Device A:
cd examples/bluetooth/bluedroid/ble_50/ble_pawr_advertiser idf.py set-target <chip_name> idf.py -p <PORT_A> build flash monitor -
Build and flash synchronizer example to Device B:
cd examples/bluetooth/bluedroid/ble_50/ble_pawr_synchronizer idf.py set-target <chip_name> idf.py -p <PORT_B> build flash monitor -
Power on Device A first (advertiser starts broadcasting)
-
Power on Device B (synchronizer starts scanning)
-
Device B will automatically detect Device A by device name "ESP_EXTPAwR_ADV"
-
Device B creates periodic sync and selects subevents
-
Both devices exchange PAwR data
Expected Log Hints:
On Synchronizer (Device B):
Extended scanning start, status 0Local address cached: XX:XX:XX:XX:XX:XX, type = XCreate sync with the peer device ESP_EXTPAwR_ADVPeriodic advertising sync establish, status 0PA sync subevent, status 0create attribute table successfully, the number handle = XService started, service_handle = XSet PA response data, status 0(repeatedly when sending responses)[Connection established], conn_id = 0xXXXX(when advertiser connects)
On Advertiser (Device A):
PAwR advertising started successfully[Request] data: 0x00, subevt start:0, subevt count:5[Response] adv_handle:0, subevent:0, tx_status:0, num_rsp:1