Esp32S3 : Is the Bluedroid stack compatible with stacks from other brands ?

ThomasESP32
Posts: 214
Joined: Thu Jul 14, 2022 5:15 am

Esp32S3 : Is the Bluedroid stack compatible with stacks from other brands ?

Postby ThomasESP32 » Wed Sep 06, 2023 9:49 am

Good morning,

I am working with an Esp32S3 and I have a question concerning the Bluedroid stack.
Could you please help me on this subject ?

In my application, a BLE chip from another brand (Silicon Labs), having its BLE stack is Reading one of the characteristic of my Esp32S3 BLE Chip.

1) In the Esp32S3 firmware, I receive the ESP_GATTS_READ_EVT event in the gatts_profile_event_handler method.
I am displaying some of the informations of the event when it is received :
ESP_LOGI(TAG, "ESP_GATTS_READ_EVT : CnxId(%u), TransId(%lu), Handle(%u), OffSet(%u), IsLong(%u), NeedRsp(%u).",
param->read.conn_id,
param->read.trans_id,
param->read.handle,
param->read.offset,
param->read.is_long,
param->read.need_rsp);
Here is the result :
ESP_GATTS_READ_EVT : CnxId(0), TransId(1), Handle(52), OffSet(0), IsLong(0), NeedRsp(0)

Then, the firmware prepares the answer :
memset(&rsp, 0x00, sizeof(esp_gatt_rsp_t));
rsp.attr_value.handle = param->read.handle;
rsp.attr_value.len = 9;
rsp.attr_value.value[0] = 1;
rsp.attr_value.value[1] = 2;
rsp.attr_value.value[2] = 3;
rsp.attr_value.value[3] = 4;
rsp.attr_value.value[4] = 5;
rsp.attr_value.value[5] = 6;
rsp.attr_value.value[6] = 7;
rsp.attr_value.value[7] = 8;
rsp.attr_value.value[8] = 9;

After that, the answer is send using the method :
ErrorCode = esp_ble_gatts_send_response(pTaskBluetooth->GattSIf,
param->read.conn_id,
param->read.trans_id,
ESP_GATT_OK,
&rsp);

And informations are displayed again (In order to know if the answer has been sent correctly or not) :
ESP_LOGI(TAG, "ESP_GATTS_READ_EVT - esp_ble_gatts_send_response(%u, %u, %lu, %u, &res), ErrorCode : 0x%04X",
pTaskBluetooth->GattSIf,
param->read.conn_id,
param->read.trans_id,
ESP_GATT_OK,
ErrorCode);

Here is what is displayed under the console :
ESP_GATTS_READ_EVT - esp_ble_gatts_send_response(3, 0, 1, 0, &res), ErrorCode : 0x0000
E (21294) BT_GATT: GATTS_SendRsp conn_id: 3 waiting for op_code = 00
E (21301) BT_APPL: Sending response failed

So the first line tells that the response has been sent correctly, but the other lines seam to tell that something is wrong.
After that, I receive the ESP_GATTS_RESPONSE_EVT for the Handle(52) and the ErrorCode is 0x0000.

2) Debuging the firmware of the Silicon Labs Chip :
- A break point is triggered when the answer is received in the firmware.
- The CndId of the answer is 1 (OK the CnxId 0 does not exist in the Silicon Labs stack).
- The Handle is 52 (OK)
- An att_opcode is displayed : 11 => Do you know what it is ?
- The offset is 0 (OK).
- The length of the answer is (246) => Not sure it is OK because the length of my answer is only 9. (However the MTU negociated is 247 so ...)
- Datas are all 0 ...

Do you know what happened ?
Do you know what the Esp32S3 displays errors under the console while sending the answer ?
Do you know why the datas are all 0 on the other side ?

Thank you for your answers/help !
Best regards,

ThomasESP32
Posts: 214
Joined: Thu Jul 14, 2022 5:15 am

Re: Esp32S3 : Is the Bluedroid stack compatible with stacks from other brands ?

Postby ThomasESP32 » Wed Sep 06, 2023 12:50 pm

Sorry,
I have the answer...
The characteristic was configured in Auto Response so the datas sent were not the ones I expected.

Now, everything is OK.

Best regards,

Thomas TRUILHE

Who is online

Users browsing this forum: Bing [Bot] and 105 guests