master device : S21, android
source : example_ble_sec_gatts_demo
edited code :
Code: Select all
static esp_ble_adv_params_t heart_rate_adv_params = {
.adv_int_min = 0x100,
.adv_int_max = 0x100,
.adv_type = ADV_TYPE_IND,
.own_addr_type =BLE_ADDR_TYPE_PUBLIC, // edit_1
.channel_map = ADV_CHNL_ALL,
.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
};
Code: Select all
case ESP_GATTS_CONNECT_EVT:
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_CONNECT_EVT");
/* start security connect with peer device when receive the connect event sent by the master */
esp_ble_set_encryption(param->connect.remote_bda, ESP_BLE_SEC_ENCRYPT); //edit_2
break;
Code: Select all
esp_ble_auth_req_t auth_req = ESP_LE_AUTH_REQ_SC_BOND; //edit_3
when i connect to esp32s3 at first time, it's successly connected.
then, i turn esp32s3 off and turn on to connect after disconnected.
at this time, esp32s3 is repeatedly between connected and disconnected.
terminal show me below log
I (4061) SEC_GATTS_DEMO: 7a 31 08 03 9d 36
W (4131) BT_HCI: hcif disc complete: hdl 0x1, rsn 0x3d
I (4131) SEC_GATTS_DEMO: ESP_GATTS_DISCONNECT_EVT, disconnect reason 0x3d
I (4141) SEC_GATTS_DEMO: advertising start success
I (4571) SEC_GATTS_DEMO: ESP_GATTS_CONNECT_EVT
I (4871) SEC_GATTS_DEMO: remote BD_ADDR: 7a3108039d36
I (4871) SEC_GATTS_DEMO: address type = 1
I (4871) SEC_GATTS_DEMO: pair status = success
I (4871) SEC_GATTS_DEMO: auth mode = ESP_LE_AUTH_REQ_SC_BOND
I (4881) SEC_GATTS_DEMO: Bonded devices number : 1
I (4881) SEC_GATTS_DEMO: Bonded devices list : 1
I (4891) SEC_GATTS_DEMO: 7a 31 08 03 9d 36
W (4961) BT_HCI: hcif disc complete: hdl 0x1, rsn 0x3d
I (4961) SEC_GATTS_DEMO: ESP_GATTS_DISCONNECT_EVT, disconnect reason 0x3d
I (4961) SEC_GATTS_DEMO: advertising start success
I (5251) SEC_GATTS_DEMO: ESP_GATTS_CONNECT_EVT
I (5501) SEC_GATTS_DEMO: remote BD_ADDR: 7a3108039d36
I (5501) SEC_GATTS_DEMO: address type = 1
I (5501) SEC_GATTS_DEMO: pair status = success
I (5501) SEC_GATTS_DEMO: auth mode = ESP_LE_AUTH_REQ_SC_BOND
I (5511) SEC_GATTS_DEMO: Bonded devices number : 1
I (5521) SEC_GATTS_DEMO: Bonded devices list : 1
I (5521) SEC_GATTS_DEMO: 7a 31 08 03 9d 36
W (5591) BT_HCI: hcif disc complete: hdl 0x1, rsn 0x3d
I (5591) SEC_GATTS_DEMO: ESP_GATTS_DISCONNECT_EVT, disconnect reason 0x3d
I (5601) SEC_GATTS_DEMO: advertising start success
I (6031) SEC_GATTS_DEMO: ESP_GATTS_CONNECT_EVT
I (6281) SEC_GATTS_DEMO: remote BD_ADDR: 7a3108039d36
I (6281) SEC_GATTS_DEMO: address type = 1
I (6281) SEC_GATTS_DEMO: pair status = success
I (6281) SEC_GATTS_DEMO: auth mode = ESP_LE_AUTH_REQ_SC_BOND
I (6291) SEC_GATTS_DEMO: Bonded devices number : 1
I (6301) SEC_GATTS_DEMO: Bonded devices list : 1
I (6301) SEC_GATTS_DEMO: 7a 31 08 03 9d 36
W (6371) BT_HCI: hcif disc complete: hdl 0x1, rsn 0x3d
I (6371) SEC_GATTS_DEMO: ESP_GATTS_DISCONNECT_EVT, disconnect reason 0x3d
I (6381) SEC_GATTS_DEMO: advertising start success
I (6811) SEC_GATTS_DEMO: ESP_GATTS_CONNECT_EVT
I (7161) SEC_GATTS_DEMO: remote BD_ADDR: 7a3108039d36
I (7161) SEC_GATTS_DEMO: address type = 1
I (7161) SEC_GATTS_DEMO: pair status = success
I (7161) SEC_GATTS_DEMO: auth mode = ESP_LE_AUTH_REQ_SC_BOND
I (7171) SEC_GATTS_DEMO: Bonded devices number : 1
I (7171) SEC_GATTS_DEMO: Bonded devices list : 1
I (7181) SEC_GATTS_DEMO: 7a 31 08 03 9d 36
could you let me know what it's reason?
thank you in advance