"BT_APPL: earlier enc was not done for same device" Cause and solution

S-Yamamoto
Posts: 6
Joined: Thu Aug 31, 2023 1:19 am

"BT_APPL: earlier enc was not done for same device" Cause and solution

Postby S-Yamamoto » Thu Aug 31, 2023 1:41 am

Hi @Everyone
I recently started using ESP32.
I'm using Arduino IDE (2.1.1) with ESP32 (2.0.11) installed.
I would like you to help me.

I'm using ESP32 on the client.
When connecting to a BLE device, the BLE error "E (33524) BT_APPL: earlier enc was not done for same device" occurs.

I would like to know about the following.

the cause of the error
How to solve the erro
Attachments
Err.PNG
Err.PNG (2.29 KiB) Viewed 2774 times

S-Yamamoto
Posts: 6
Joined: Thu Aug 31, 2023 1:19 am

Re: "BT_APPL: earlier enc was not done for same device" Cause and solution

Postby S-Yamamoto » Mon Sep 04, 2023 12:10 am

Hi @Everyone

I found where the "E (33524) BT_APPL: No previous enc was run for the same device" occurs.

The issue occurs when connecting to the BLE device in client mode ("pClient = BLEDevice::createClient()") after running "pServer = BLEDevice::createServer()" for ESP32.
Running "pServer->disconnect(pServer->getConnId())" enables client mode, and server and client are not used at the same time.

I need to use BLE server and client on one ESP32.
I would like to know about:

1) Error meaning
2) How to resolve the error

S-Yamamoto
Posts: 6
Joined: Thu Aug 31, 2023 1:19 am

Re: "BT_APPL: earlier enc was not done for same device" Cause and solution

Postby S-Yamamoto » Wed Sep 06, 2023 4:14 am

Hi @Everyone

Help me.
I found where the "E (33524) BT_APPL: No previous enc was run for the same device" occurs.

This issue occurs when running [1],[2] simultaneously on ESP32 and connecting to a BLE device in client mode ('pClient = BLEDevice::createClient()').
[1]pServer = BLEDevice::createServer()
[2]BLEDevice::setEncryptionLevel(ESP_BLE_SEC_ENCRYPT);

You need to use BLE server and client on one ESP32.
I would like to know if "E (33524) BT_APPL: No previous enc has been executed for the same device" is an error or a warning.

S-Yamamoto
Posts: 6
Joined: Thu Aug 31, 2023 1:19 am

Re: "BT_APPL: earlier enc was not done for same device" Cause and solution

Postby S-Yamamoto » Thu Sep 07, 2023 6:06 am

Hi @Everyone

I will report it. :D
The solution for "E (33524) BT_APPL: No previous enc was run for the same device" was the following steps:

[Step 1] pServer = BLEDevice::createServer()
[Step 2] Initialize BLE with BLEDevice::init() after BLEDevice::deinit(false)
[Step 3] pClient = BLEDevice::createClient();

E (33524) BT_APPL: No previous enc run for the same device no longer occurs.
I think the reason is that you don't create the server and client at the same time.

Who is online

Users browsing this forum: username and 133 guests