Not able to disconnect bluetooth connection from android mobile

sabaridev
Posts: 2
Joined: Wed Jan 04, 2023 7:43 am

Not able to disconnect bluetooth connection from android mobile

Postby sabaridev » Wed Jan 04, 2023 8:59 am

Hi Team,

I am working on a ble android application which talks to device which has esp32 firmware installed.

Issue: Not able to disconnect from device when notification is enabled.

Application scenario:

1. Connect To device
2. Enable Notification
3. Send Command
4. Receive Data
5. Disable Notification
6. Disconnect

I could connect to the device and enable notification using the following characteristic 0000c306-0000-1000-8000-00805f9b34fb: INDICATABLE. Once connected i could write and get the response back using characteristic 0000c304-0000-1000-8000-00805f9b34fb: WRITABLE.

When i try to disable the notification and disconnect, the module is not responding with any logs or commands.
Hence cannot disconnect from the device.

But i could disconnect from device if i just do only the steps (1 , 6). Issue is without the step 2 we will not able to receive any data from the bluetooth device if the notification characteristic is not enabled, hence the application will not work.

Please help on disable and disconnect AT commands with any documents or reference if we can get or let me know if any more information needed on the issue.


Regards,
Sabari

ESP_Sun
Posts: 320
Joined: Thu Dec 30, 2021 9:52 am

Re: Not able to disconnect bluetooth connection from android mobile

Postby ESP_Sun » Fri Jan 06, 2023 2:34 am

sabaridev wrote:
Wed Jan 04, 2023 8:59 am
Hi Team,

I am working on a ble android application which talks to device which has esp32 firmware installed.

Issue: Not able to disconnect from device when notification is enabled.

Application scenario:

1. Connect To device
2. Enable Notification
3. Send Command
4. Receive Data
5. Disable Notification
6. Disconnect

I could connect to the device and enable notification using the following characteristic 0000c306-0000-1000-8000-00805f9b34fb: INDICATABLE. Once connected i could write and get the response back using characteristic 0000c304-0000-1000-8000-00805f9b34fb: WRITABLE.

When i try to disable the notification and disconnect, the module is not responding with any logs or commands.
Hence cannot disconnect from the device.

But i could disconnect from device if i just do only the steps (1 , 6). Issue is without the step 2 we will not able to receive any data from the bluetooth device if the notification characteristic is not enabled, hence the application will not work.

Please help on disable and disconnect AT commands with any documents or reference if we can get or let me know if any more information needed on the issue.


Regards,
Sabari
Hi,

Maybe you can provide a complete log of the AT command sequence used in the following two cases: ble can disconnect, but can't disconnect?
Maybe you can provide the AT version information? (You can use the AT+GMR command to query)

sabaridev
Posts: 2
Joined: Wed Jan 04, 2023 7:43 am

Re: Not able to disconnect bluetooth connection from android mobile

Postby sabaridev » Mon Jan 09, 2023 8:22 am

Hi Team,

Please find the below logs:

Scenario 1: Ble Can Disconnect:

Code: Select all

RTC time EXT = 0:1:1:0:0:0

MQTT INit call 2 
UART4 RX = +BLECONN:0,"52:ff:03:15:84:83"

 BLE connected
UART4 RX = AT+BLEGATTSSRV?
UART4 RX = +BLEGATTSSRV:1,1,0xA002,1
UART4 RX = +BLEGATTSSRV:2,1,0xA003,1
UART4 RX = 
UART4 RX = OK
UART4 RX = AT+BLEGATTSCHAR?
UART4 RX = +BLEGATTSCHAR:"char",1,1,0xC300,0x02
UART4 RX = +BLEGATTSCHAR:"desc",1,1,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",1,2,0xC301,0x02
UART4 RX = +BLEGATTSCHAR:"desc",1,2,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",1,3,0xC302,0x08
UART4 RX = +BLEGATTSCHAR:"desc",1,3,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",1,4,0xC303,0x04
UART4 RX = +BLEGATTSCHAR:"desc",1,4,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",1,5
M,0xQTTC30 IN4,0it x08cal
Ul 1ART2 
4 R
X = +BLEGATTSCHAR:"char",1,6,0xC305,0x10
UART4 RX = +BLEGATTSCHAR:"desc",1,6,1,0x2902
UART4 RX = +BLEGATTSCHAR:"char",1,7,0xC306,0x20
UART4 RX = +BLEGATTSCHAR:"desc",1,7,1,0x2902
UART4 RX = +BLEGATTSCHAR:"char",1,8,0xC307,0x02
UART4 RX = +BLEGATTSCHAR:"desc",1,8,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",2,1,0xC400,0x02
UART4 RX = +BLEGATTSCHAR:"desc",2,1,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",2,2RTC,0 tixCme 40EXT1, = 0x0:102:1:
0:0UA:0
RT
4 RX = +BLEGATTSCHAR:"desc",2,2,1,0x2901
UART4 RX = 
UART4 RX = OK
UART4 RX = +BLECONNPARAM:0,0,0,6Ign,0,iti500on=
U1
ART4 RX = AT+BLESPPCFG=1,1,7,1,5
UART4 RX = 
UART4 RX = +BLECFGMTU:0,517
UART4 RX = +BLECONNPARAM:0,0,0,36,0,500
UART4 RX = +BLECONNPARAM:0,0,0,9,0,500
UART4 RX = +WRITE:0,1,5,,14,$SHOW_STATUS
UART4 RX = 
Show statUARus T4 comRX man= [d: SHO[SHW_SOW_TATSTAUS]TUS,11],122412210041024,024T06,T0080608107010002700,,,2,,860,86195019052505196219588658,,,8,,A,,,A,,,2,,,9,,29,0,1,0,,151,1.615.6,0.1,005,.05,,,,,,,,,,,,0,0,0,,,00,,,,,0,,
U,
ART, 94 R9X = 
UART4 RX = ERROR
RTC time EXT = 0:1:1:0:0:0
RTC time EXT = 0:1:1:0:0:0
UART4 RX = +BLEDISCONN:0,"52:ff:03:15:84:83"

 BLE disconnected
UART4 RX = AT+BLEGATTSSRVSTART
UART4 RX = 
UART4 RX = OK
UART4 RX = AT+BLEADVSTART
UART4 RX = 
UART4 RX = OK
RTC time EXT = 0:1:1:0:0:0
RTC time EXT = 0:1:1:0:0:0
Scenario 2 [Ble cannot disconnect]:

Code: Select all

RTC time EXT = 0:1:1:0:0:0
RTC time EXT = 0:1:1:0:0:0
UART4 RX = +BLECONN:0,"52:74:44:a9:1f:c1"

 BLE connected
UART4 RX = AT+BLEGATTSSRV?
UART4 RX = +BLEGATTSSRV:1,1,0xA002,1
UART4 RX = +BLEGATTSSRV:2,1,0xA003,1
UART4 RX = 
UART4 RX = OK
UART4 RX = AT+BLEGATTSCHAR?
UART4 RX = +BLEGATTSCHAR:"char",1,1,0xC300,0x02
UART4 RX = +BLEGATTSCHAR:"desc",1,1,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",1,2,0xC301,0x02
UART4 RX = +BLEGATTSCHAR:"desc",1,2,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",1,3,0xC302,0x08
UART4 RX = +BLEGATTSCHAR:"desc",1,3,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",1,4,0xC303,0x04
UART4 RX = +BLEGATTSCHAR:"desc",1,4,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",1,5,0xC304,0x08
UART4 RX = +BLEGATTSCHAR:"char",1,6,0xC305,0x10
UART4 RX = +BLEGATTSCHAR:"desc",1,6,1,0x2902
UART4 RX = +BLEGATTSCHAR:"char",1,7,0xC306,0x20
UART4 RX = +BLEGATTSCHAR:"desc",1,7,1,0x2902
UART4 RX = +BLEGATTSCHAR:"char",1,8,0xC307,0x02
UART4 RX = +BLEGATTSCHAR:"desc",1,8,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",2,1,0xC400,0x02
UART4 RX = +BLEGATTSCHAR:"desc",2,1,1,0x2901
UART4 RX = +BLEGATTSCHAR:"char",2,2,0xC401,0x02
UART4 RX = +BLECONNPARAM:0,0,0,6,0,500
UART4 RX = AT+BLESPPCFG=1,1,7,1,5
UART4 RX = 
UART4 RX = OK
UARTCRT4 ti RXme  = EXT+BL = ECF0:1GMT:1:U:00:0,51:0
7

UART4 RX = +BLECONNPARAM:0,0,0,36,0,500
UART4 RX = +BLECONNPARAM:0,0,0,9,0,500
UART4 RX = +WRITE:0,1,6,1,2,UART4 RX = +WRITE:0,1,5,,1,
UART4 RX = +WRITE:0,1,7,1,2,UART4 RX = AT+BLESPP
UART4 RX = 
UART4 RX = OK
UART4 RX = 
RTC time EXT = 0:1:1:0:0:0
UART4 RX = >$SHOW_STATUS
Show status command: [SHOW_STATUS],1122410024,T06080107002,,,860195052196588,,,A,,,,30,,0,1,15.62,0.05,,,,,,,0,0,,0,,,
, 99RTC time EXT = 0:1:1:0:0:0
RTC time EXT = 0:1:1:0:0:0
RTC time EXT = 0:1:1:0:0:0
RTC time EXT = 0:1:1:0:0:0

In the second scenario log, we can notice the write UART4 RX = +WRITE:0,1,7,1,2 which is for enabling notify characteristic in order for the mobile app to receive data on character changed callback. But whenever this is enabled the BLE device is not actually getting disconnected. so we are not receiving any logs.

I have attached the log file for reference.
Attachments
ble log without notify set.txt
(2.03 KiB) Downloaded 160 times
ble non working log (1).txt
(1.78 KiB) Downloaded 242 times

Who is online

Users browsing this forum: No registered users and 47 guests