Struggling with creating a BLE server.

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Struggling with creating a BLE server.

Postby fly135 » Mon Feb 12, 2018 8:33 pm

I've been trying to get the ESP32 to work as a BLE server with little luck. I just posted what appears to be a bug in the bug reporting section of the forum. Nothing I've tried so far has worked to connect with any app on my Android and I've found what appears to be suspicious behavior. I'v found that in responding to GATT (get by type) requests when the ESP is supposed to respond with a error that the attribute is not found, it does not send the response and appears to disconnect immediately. This would explain why it fails to communicate with any apps and just abruptly disconnects.

I've traced through the stack and found the proper "attribute no found" error response makes it's way all the way to the function...

UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf)

The BT_HDR has the correct opcode, len, and the 5 bytes of data that are the proper error response. The function exits successfully, but the BLE packet sniffer never sees the server to client response. Also the connection is dropped in the ESP32 while the client is still hanging out waiting.

Hard to believe that nobody else is seeing this error. Has anyone successfully managed to set up a connection with a "real" BLE client vs one that doesn't query the handles?

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Struggling with creating a BLE server.

Postby fly135 » Wed Feb 14, 2018 2:03 am

Starting to think it might be my Samsung S5 that's part of the problem. I'm able to run gatt_client and gatt_server on two esp32 boards. I'm also able to run my code that is a ble server and when connecting to it with gatt_client modified to search it's name, it connects and queries just fine. When running nRF Connect or Bluefruit LE it doesn't seem to be able to finish the query for services and characteristics.

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Struggling with creating a BLE server.

Postby fly135 » Thu Feb 15, 2018 4:34 am

Picked up a iPhone 6 today for testing and it works . Apparently there is some issue between the ESP32 and Android 4.4.2 on my Samsung S5 that is preventing it from working. Going to try someone's phone that has a newer Android version next.

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 182 guests