Issue with pairing the BLE with my mobile phone

ggeorge
Posts: 32
Joined: Mon Mar 07, 2022 6:00 am

Issue with pairing the BLE with my mobile phone

Postby ggeorge » Mon May 16, 2022 2:19 pm

Initialization steps followed:

UART4_Write("AT\r\n",4);
UART4_Write("AT+CWMODE?\r\n",12);
UART4_Write("AT+BLENAME?\r\n",13);
UART4_Write("AT+BLEINIT=2\r\n",14);
UART4_Write("AT+CWMODE=1\r\n",13);
UART4_Write("AT+BLEADVDATAEX=\"ESP_AT\",\"0000\",\"0000\",1\r\n",43);
UART4_Write("AT+BLEGATTSSRVCRE\r\n",19);
UART4_Write("AT+BLEGATTSSRVSTART\r\n",21);
UART4_Write("AT+BLEADVSTART\r\n",16);
UART4_Write("AT+SYSSTORE=1\r\n",15);

Once this is done, ESP_AT is visible on my phone, but as soon as I click the ESP_AT shown on my screen, it automatically disconnects with +DISCONN print and sometimes there are no prints.

My application requirement is to send a data from my mobile phone to the ESP32C3 Module and receive back the same data to my mobile. Kindly support me on this.

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

Re: Issue with pairing the BLE with my mobile phone

Postby ESP_Sun » Tue May 17, 2022 6:30 am

Execute the at + clearvdataex command and the device has already started broadcasting, so you don't need to execute at + clearvdstart. You can refer to the document <establish spp connection between esp32 and mobile phone and transmit data in UART Bluetooth Le passthrough mode>(https://docs.espressif.com/projects/esp ... rough-mode).

ggeorge
Posts: 32
Joined: Mon Mar 07, 2022 6:00 am

Re: Issue with pairing the BLE with my mobile phone

Postby ggeorge » Tue May 17, 2022 7:22 am

I am referring to the same document : https://docs.espressif.com/projects/esp ... rough-mode

My BLE still disconnects as soon as I click to connect on my phone. Is there a process to follow for initialization as well?

ggeorge
Posts: 32
Joined: Mon Mar 07, 2022 6:00 am

Re: Issue with pairing the BLE with my mobile phone

Postby ggeorge » Tue May 17, 2022 11:10 am

USART4 RX = AT+BLEINIT=2
USART4 RX =
USART4 RX = OK
USART4 RX = AT+BLEGATTSSRVCRE
USART4 RX =
USART4 RX = OK
USART4 RX = AT+BLEGATTSSRVSTART
USART4 RX =
USART4 RX = OK
USART4 RX = AT+BLEADDR?
USART4 RX = +BLEADDR:"34:b4:72:b2:68:52"
USART4 RX = OK
USART4 RX = AT+BLEADVDATA="0201060A09457370726573736966030302A0"
USART4 RX =
USART4 RX = OK
USART4 RX = AT+BLEADVSTART
USART4 RX =
USART4 RX = OK
USART4 RX = AT+BLEGATTSSRV?
USART4 RX = +BLEGATTSSRV:1,1,0xA002,1
USART4 RX = +BLEGATTSSRV:2,1,0xA003,1
USART4 RX =
USART4 RX = OK
USART4 RX = AT+BLEGATTSCHAR?
USART4 RX = +BLEGATTSCHAR:"char",1,1,0xC300,0x02
USART4 RX = +BLEGATTSCHAR:"desc",1,1,1,0x2901
USART4 RX = +BLEGATTSCHAR:"char",1,2,0xC301,0x02
USART4 RX = +BLEGATTSCHAR:"desc",1,2,1,0x2901
USART4 RX = +BLEGATTSCHAR:"char",1,3,0xC302,0x08
USART4 RX = +BLEGATTSCHAR:"desc",1,3,1,0x2901
USART4 RX = +BLEGATTSCHAR:"char",1,4,0xC303,0x04
USART4 RX = +BLEGATTSCHAR:"desc",1,4,1,0x2901
USART4 RX = +BLEGATTSCHAR:"char",1,5,0xC304,0x08
USART4 RX = +BLEGATTSCHAR:"char",1,6,0xC305,0x10
USART4 RX = +BLEGATTSCHAR:"desc",1,6,1,0x2902
USART4 RX = +BLEGATTSCHAR:"char",1,7,0xC306,0x20
USART4 RX = +BLEGATTSCHAR:"desc",1,7,1,0x2902
USART4 RX = +BLEGATTSCHAR:"char",1,8,0xC307,0x02
USART4 RX = +BLEGATTSCHAR:"desc",1,8,1,0x2901
USART4 RX = +BLEGATTSCHAR:"char",2,1,0xC400,0x02
USART4 RX = +BLEGATTSCHAR:"desc",2,1,1,0x2901
USART4 RX = +BLEGATTSCHAR:"char",2,2,0xC401,0x02
USART4 RX = +BLEGATTSCHAR:"desc",2,2,1,0x2901
USART4 RX =
USART4 RX = OK

After this I am triggering for connection from my mobile and this is what I receive.

USART4 RX = +BLECONN:0,"6d:67:23:33:0b:c4"

BLE connected

USART4 RX = +BLEDISCONN:0,"6d:67:23:33:0b:c4"

It disconnects in a second. As I get the disconnected message, the BLE is no longer discoverable. I am not triggering any disconnection from my end. Kindly help me resolve this issue.

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

Re: Issue with pairing the BLE with my mobile phone

Postby ESP_Sun » Thu May 19, 2022 2:01 am

Can you provide ESP-AT version information (query with at + GMR command)? You can test it with another mobile phone to see if there are the same issue.

ggeorge
Posts: 32
Joined: Mon Mar 07, 2022 6:00 am

Re: Issue with pairing the BLE with my mobile phone

Postby ggeorge » Thu May 19, 2022 8:04 am

USART4 RX = AT+GMR
USART4 RX = AT version:2.3.0.0(e98993f - ESP32C3 - Dec 23 2021 09:03:35)
USART4 RX = SDK version:v4.3.1-354-g98d34e5
USART4 RX = compile time(9ff1373):Dec 24 2021 11:22:05
USART4 RX = Bin version:2.3.0(MINI-1)

This is what I receive from the module.

ggeorge
Posts: 32
Joined: Mon Mar 07, 2022 6:00 am

Re: Issue with pairing the BLE with my mobile phone

Postby ggeorge » Thu May 19, 2022 1:19 pm

Sometimes, I am able to connect and send data over SPP but sometimes it gets disconnected. It's not stable, does the RF power values have anything to do with them?

Is there a ideal value to set for RF power?

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

Re: Issue with pairing the BLE with my mobile phone

Postby ESP_Sun » Fri May 20, 2022 3:43 am

How long will disconnection occur after connecting the device? If possible, you can provide logs. Try a higher RF setting, but the higher the RF setting, the higher the power consumption. You can capture packets to see who disconnected first.

ggeorge
Posts: 32
Joined: Mon Mar 07, 2022 6:00 am

Re: Issue with pairing the BLE with my mobile phone

Postby ggeorge » Fri May 20, 2022 6:44 am

The disconnection happens in 5 seconds after connecting, I have an ESP32C3 client configured, I am trying to connect it to my ESP32C3 server which is located on my board. How to capture packets to see who disconnected first?

To me it looks like the server & client both are initiating the disconnection.

This is my query log for AT+BLEADVPARAM?

UART4 RX = +BLEADVPARAM:32,64,0,0,7,0,0,"00:00:00:00:00:00"
UART4 RX = OK

What should be these values? Does these values create any issues?

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

Re: Issue with pairing the BLE with my mobile phone

Postby ESP_Sun » Fri May 20, 2022 7:16 am

You can use the AT master branch to test if it will also disconnects.

Who is online

Users browsing this forum: No registered users and 44 guests