esp-rainmaker icon indicating copy to clipboard operation
esp-rainmaker copied to clipboard

The connection of the device is lost when the mobile APP is connected (MEGH-4593)

Open perseverance51 opened this issue 1 year ago • 8 comments

Answers checklist.

  • [X] I have read the Rainmaker documentation and the issue is not addressed there.
  • [X] I have updated my IDF branch (release/vX.Y) to the latest version and checked that the issue is present there. This is not applicable if you are using Rainmaker with Arduino.
  • [X] I have searched the Rainmaker forum and issue tracker for a similar issue and not found a similar issue.

IDF / ESP32-Arduino version.

ESP-IDF v4.4.4-dirty

Operating System used.

Windows

How did you build your project?

Command line with idf.py

Development Kit.

ESP-IDF4.4

What is the expected behavior?

The APP searches for the ESPThe sample project of esp-rainmaker\examples\switch compiled by espidf 4.4 was uploaded to the esp32 devkit v1 device. After searching for the Bluetooth device of ESP32, the mobile APP clicked Connect, but the device disappeared immediately.32 Bluetooth device, clicks Connect, and the device disappears again.

What is the actual behavior?

The APP searches for the ESP32 Bluetooth device, clicks Connect, and the device disappears again.

Steps to reproduce.

When you search for an esp32 Bluetooth device, click on the connected device and it disappears。 Screenshot_2023-04-21-13-28-53

Screenshot_2023-04-21-13-28-37

Debug Logs.

[13:13:37.523] [0;32mI (1952) app_wifi: If QR code is not visible, copy paste the below URL in a browser.
[13:13:37.523] https://rainmaker.espressif.com/qrcode.html?data={"ver":"v1","name":"PROV_518642","pop":"ed768537","transport":"ble"}[0m
[13:13:37.523] [0;32mI (1962) app_main: Provisioning QR : {"ver":"v1","name":"PROV_518642","pop":"ed768537","transport":"ble"}[0m
[13:13:37.523] [0;32mI (1972) app_wifi: Provisioning Started. Name : PROV_518642, POP : ed768537[0m
[13:13:37.523] [0;32mI (1982) app_wifi: Provisioning will auto stop after 30 minute(s).[0m
[13:13:37.523] 
[13:13:51.060] [0;32mI (15542) NimBLE: GAP procedure initiated: advertise; [0m
[13:13:51.082] [0;32mI (15542) NimBLE: disc_mode=2[0m
[13:13:51.082] [0;32mI (15542) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=256 adv_itvl_max=256[0m
[13:13:51.082] [0;32mI (15552) NimBLE: 
[13:13:51.082] [0m
[13:13:51.082] 
[13:13:58.518] [0;32mI (23002) NimBLE: GAP procedure initiated: advertise; [0m
[13:13:58.541] [0;32mI (23002) NimBLE: disc_mode=2[0m
[13:13:58.541] [0;32mI (23002) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=256 adv_itvl_max=256[0m
[13:13:58.541] [0;32mI (23002) NimBLE: 
[13:13:58.541] [0m
[13:13:58.541]

More Information.

No response

perseverance51 avatar Apr 21 '23 05:04 perseverance51

Hi @perseverance51 , What is the android app version ? Is it possible to share android app logs ?

KhushbuShah25 avatar Apr 26 '23 06:04 KhushbuShah25

Hi @perseverance51 , What is the android app version ? Is it possible to share android app logs ?

I tested all of the following apps: ESP_RainMaker_2.10.1, 2.8.0, and ESP_BLE_Prov_2.1.0. I also tested the ESP RainMaker routine burning with the Arduino IDE and connected to the mobile APP.

perseverance51 avatar Apr 27 '23 02:04 perseverance51

@shukur-alom , your query has been answered here. Just as an additional note, please avoid asking questions on issues unrelated to yours. This specific issue is about provisioning itself failing that too with esp-idf. Your issue is about device not reconnecting after losing Wi-Fi, that too (most probably) with Arduino.

shahpiyushv avatar Apr 28 '23 07:04 shahpiyushv

@perseverance51 , can you enable additional debug logs using idf.py menuconfig and retry?

Component Config --> Log Output --> Default Log Verbosity --> Debug

Component Config --> Bluetooth --> NimBLE Options --> NimBLE Host log verbosity --> Debug Logs

Meanwhile, what is your phone model and Android version? Have you tried with a different phone?

shahpiyushv avatar Apr 28 '23 07:04 shahpiyushv

@shahpiyushv I can connect to esp32 using other Bluetooth debugging apps. When I disconnected the ESP32 ble device and went back to the ESP RainMaker APP interface to try to connect to esp32, I was able to pull up the connection and successfully connect to the device. I'm not sure if it's because the third-party Bluetooth APP debug assistant successfully logged in or something. Screenshot_2023-04-30-13-24-46

perseverance51 avatar Apr 30 '23 05:04 perseverance51

The same thing happens when you add a new esp32 Bluetooth device, so as long as the connected device has been successfully connected before and then re-paired, it won't be disconnected again.

  • The following is the log printed when a new device is connected and disconnected: ` [17:42:35.248] D (185578) protocomm_nimble: Inside BLE connect w/ conn_id - 1[0m [17:42:35.248] D (185578) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0016 len=2 [17:42:35.248] [0m [17:42:35.248] D (185578) NimBLE: 0x16 [0m [17:42:35.248] D (185578) NimBLE: 0x20 [0m [17:42:35.248] D (185588) NimBLE: 0x02 [0m [17:42:35.248] D (185588) NimBLE: 0x01 [0m [17:42:35.248] D (185588) NimBLE: 0x00 [0m [17:42:35.248] D (185588) NimBLE: [17:42:35.248] [0m [17:42:35.248] [17:42:37.093] D (187398) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0020 len=14 [17:42:37.093] [0m [17:42:37.093] D (187398) NimBLE: 0x20 [0m [17:42:37.093] D (187398) NimBLE: 0x20 [0m [17:42:37.093] D (187398) NimBLE: 0x0e [0m [17:42:37.093] D (187398) NimBLE: 0x01 [0m [17:42:37.093] D (187408) NimBLE: 0x00 [0m [17:42:37.093] D (187408) NimBLE: 0x06 [0m [17:42:37.093] D (187408) NimBLE: 0x00 [0m [17:42:37.093] D (187408) NimBLE: 0x06 [0m [17:42:37.093] D (187418) NimBLE: 0x00 [0m [17:42:37.093] D (187418) NimBLE: 0x00 [0m [17:42:37.093] D (187418) NimBLE: 0x00 [0m [17:42:37.093] D (187418) NimBLE: 0xf4 [0m [17:42:37.093] D (187428) NimBLE: 0x01 [0m [17:42:37.093] D (187428) NimBLE: 0x00 [0m [17:42:37.093] D (187428) NimBLE: 0x00 [0m [17:42:37.093] D (187428) NimBLE: 0x00 [0m [17:42:37.093] D (187438) NimBLE: 0x00 [0m [17:42:37.093] D (187438) NimBLE: [17:42:37.093] [0m [17:42:37.093] D (187668) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data=[0m [17:42:37.438] D (187668) NimBLE: 0x07 [0m [17:42:37.438] D (187668) NimBLE: 0x00 [0m [17:42:37.438] D (187668) NimBLE: 0x04 [0m [17:42:37.438] D (187668) NimBLE: 0x00 [0m [17:42:37.438] D (187678) NimBLE: 0x10 [0m [17:42:37.438] D (187678) NimBLE: 0x01 [0m [17:42:37.438] D (187678) NimBLE: 0x00 [0m [17:42:37.438] D (187678) NimBLE: 0xff [0m [17:42:37.438] D (187688) NimBLE: 0xff [0m [17:42:37.438] D (187688) NimBLE: 0x00 [0m [17:42:37.438] D (187688) NimBLE: 0x28 [0m [17:42:37.438] D (187688) NimBLE: [17:42:37.438] [0m [17:42:37.438] D (187698) NimBLE: host tx hci data; handle=1 length=26 [17:42:37.438] [0m [17:42:37.438] D (187698) NimBLE: ble_hs_hci_acl_tx(): [0m [17:42:37.438] D (187708) NimBLE: 0x01 [0m [17:42:37.438] D (187708) NimBLE: 0x00 [0m [17:42:37.438] D (187708) NimBLE: 0x1a [0m [17:42:37.438] D (187708) NimBLE: 0x00 [0m [17:42:37.438] D (187718) NimBLE: 0x16 [0m [17:42:37.438] D (187718) NimBLE: 0x00 [0m [17:42:37.438] D (187718) NimBLE: 0x04 [0m [17:42:37.438] D (187718) NimBLE: 0x00 [0m [17:42:37.438] D (187728) NimBLE: 0x11 [0m [17:42:37.438] D (187728) NimBLE: 0x14 [0m [17:42:37.438] D (187728) NimBLE: 0x01 [0m [17:42:37.438] D (187728) NimBLE: 0x00 [0m [17:42:37.438] D (187738) NimBLE: 0xff [0m [17:42:37.438] D (187738) NimBLE: 0xff [0m [17:42:37.438] D (187738) NimBLE: 0xb4 [0m [17:42:37.438] D (187748) NimBLE: 0xdf [0m [17:42:37.438] D (187748) NimBLE: 0x5a [0m [17:42:37.438] D (187748) NimBLE: 0x1c [0m [17:42:37.438] D (187748) NimBLE: 0x3f [0m [17:42:37.438] D (187758) NimBLE: 0x6b [0m [17:42:37.438] D (187758) NimBLE: 0xf4 [0m [17:42:37.438] D (187758) NimBLE: 0xbf [0m [17:42:37.438] D (187758) NimBLE: 0xea [0m [17:42:37.438] D (187768) NimBLE: 0x4a [0m [17:42:37.438] D (187768) NimBLE: 0x82 [0m [17:42:37.438] D (187768) NimBLE: 0x03 [0m [17:42:37.438] D (187768) NimBLE: 0x04 [0m [17:42:37.438] D (187778) NimBLE: 0x90 [0m [17:42:37.438] D (187778) NimBLE: 0x1a [0m [17:42:37.438] D (187778) NimBLE: 0x02 [0m [17:42:37.438] D (187778) NimBLE: [17:42:37.438] [0m [17:42:37.438] [17:42:47.624] D (197658) protocomm_nimble: disconnect; reason=520 [0m [17:42:47.624] D (197658) protocomm_nimble: Inside disconnect w/ session - 1[0m [17:42:47.624] D (197658) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0008 len=32 [17:42:47.624] [0m [17:42:47.624] D (197668) NimBLE: 0x08 [0m [17:42:47.624] D (197668) NimBLE: 0x20 [0m [17:42:47.624] D (197678) NimBLE: 0x20 [0m [17:42:47.624] D (197678) NimBLE: 0x15 [0m [17:42:47.624] D (197678) NimBLE: 0x02 [0m [17:42:47.624] D (197678) NimBLE: 0x01 [0m [17:42:47.624] D (197688) NimBLE: 0x06 [0m [17:42:47.624] D (197688) NimBLE: 0x11 [0m [17:42:47.624] D (197688) NimBLE: 0x07 [0m [17:42:47.624] D (197688) NimBLE: 0xb4 [0m [17:42:47.624] D (197698) NimBLE: 0xdf [0m [17:42:47.624] D (197698) NimBLE: 0x5a [0m [17:42:47.624] D (197698) NimBLE: 0x1c [0m [17:42:47.624] D (197698) NimBLE: 0x3f [0m [17:42:47.624] D (197708) NimBLE: 0x6b [0m [17:42:47.624] D (197708) NimBLE: 0xf4 [0m [17:42:47.624] D (197708) NimBLE: 0xbf [0m [17:42:47.624] D (197708) NimBLE: 0xea [0m [17:42:47.624] D (197718) NimBLE: 0x4a [0m [17:42:47.624] D (197718) NimBLE: 0x82 [0m [17:42:47.624] D (197718) NimBLE: 0x03 [0m [17:42:47.624] D (197728) NimBLE: 0x04 [0m [17:42:47.624] D (197728) NimBLE: 0x90 [0m [17:42:47.624] D (197728) NimBLE: 0x1a [0m [17:42:47.624] D (197728) NimBLE: 0x02 [0m [17:42:47.624] D (197738) NimBLE: 0x00 [0m [17:42:47.624] D (197738) NimBLE: 0x00 [0m [17:42:47.624] D (197738) NimBLE: 0xcc [0m [17:42:47.624] D (197738) NimBLE: 0x90 [0m [17:42:47.624] D (197748) NimBLE: 0xc9 [0m [17:42:47.624] D (197748) NimBLE: 0x3f [0m [17:42:47.624] D (197748) NimBLE: 0xd4 [0m [17:42:47.624] D (197748) NimBLE: 0xbd [0m [17:42:47.624] D (197758) NimBLE: 0x02 [0m [17:42:47.624] D (197758) NimBLE: 0x42 [0m [17:42:47.624] D (197758) NimBLE: [17:42:47.624] [0m [17:42:47.624] D (197758) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0009 len=32 [17:42:47.624] [0m [17:42:47.624] D (197768) NimBLE: 0x09 [0m [17:42:47.624] D (197768) NimBLE: 0x20 [0m [17:42:47.624] D (197778) NimBLE: 0x20 [0m [17:42:47.624] D (197778) NimBLE: 0x0d [0m [17:42:47.624] D (197778) NimBLE: 0x0c [0m [17:42:47.624] D (197778) NimBLE: 0x09 [0m [17:42:47.624] D (197788) NimBLE: 0x50 [0m [17:42:47.624] D (197788) NimBLE: 0x52 [0m [17:42:47.624] D (197788) NimBLE: 0x4f [0m [17:42:47.624] D (197788) NimBLE: 0x56 [0m [17:42:47.624] D (197798) NimBLE: 0x5f [0m [17:42:47.624] D (197798) NimBLE: 0x34 [0m [17:42:47.624] D (197798) NimBLE: 0x64 [0m [17:42:47.624] D (197798) NimBLE: 0x38 [0m [17:42:47.624] D (197808) NimBLE: 0x37 [0m [17:42:47.624] D (197808) NimBLE: 0x32 [0m [17:42:47.624] D (197808) NimBLE: 0x39 [0m [17:42:47.624] D (197808) NimBLE: 0x00 [0m [17:42:47.624] D (197818) NimBLE: 0x00 [0m [17:42:47.624] D (197818) NimBLE: 0x00 [0m [17:42:47.624] D (197818) NimBLE: 0x00 [0m [17:42:47.624] D (197818) NimBLE: 0x00 [0m [17:42:47.624] D (197828) NimBLE: 0x00 [0m [17:42:47.624] D (197828) NimBLE: 0x00 [0m [17:42:47.624] D (197828) NimBLE: 0x00 [0m [17:42:47.624] D (197838) NimBLE: 0x00 [0m [17:42:47.624] D (197838) NimBLE: 0x00 [0m [17:42:47.624] D (197838) NimBLE: 0xb0 [0m [17:42:47.624] D (197838) NimBLE: 0x1c [0m [17:42:47.624] D (197848) NimBLE: 0xcc [0m [17:42:47.624] D (197848) NimBLE: 0x3f [0m [17:42:47.624] D (197848) NimBLE: 0xd4 [0m [17:42:47.624] D (197848) NimBLE: 0xbd [0m [17:42:47.624] D (197858) NimBLE: 0x02 [0m [17:42:47.624] D (197858) NimBLE: 0x42 [0m [17:42:47.624] D (197858) NimBLE: [17:42:47.624] [0m [17:42:47.624] [0;32mI (197858) NimBLE: GAP procedure initiated: advertise; [0m [17:42:47.624] [0;32mI (197868) NimBLE: disc_mode=2[0m [17:42:47.624] [0;32mI (197868) NimBLE: adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=256 adv_itvl_max=256[0m [17:42:47.624] [0;32mI (197878) NimBLE: [17:42:47.624] [0m [17:42:47.624] D (197888) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0006 len=15 [17:42:47.624] [0m [17:42:47.624] D (197888) NimBLE: 0x06 [0m [17:42:47.624] D (197898) NimBLE: 0x20 [0m [17:42:47.624] D (197898) NimBLE: 0x0f [0m [17:42:47.624] D (197898) NimBLE: 0x00 [0m [17:42:47.624] D (197898) NimBLE: 0x01 [0m [17:42:47.624] D (197908) NimBLE: 0x00 [0m [17:42:47.624] D (197908) NimBLE: 0x01 [0m [17:42:47.624] D (197908) NimBLE: 0x00 [0m [17:42:47.624] D (197908) NimBLE: 0x00 [0m [17:42:47.624] D (197918) NimBLE: 0x00 [0m [17:42:47.624] D (197918) NimBLE: 0x00 [0m [17:42:47.624] D (197918) NimBLE: 0x00 [0m [17:42:47.624] D (197918) NimBLE: 0x00 [0m [17:42:47.624] D (197928) NimBLE: 0x00 [0m [17:42:47.624] D (197928) NimBLE: 0x00 [0m [17:42:47.624] D (197928) NimBLE: 0x00 [0m [17:42:47.624] D (197928) NimBLE: 0x07 [0m [17:42:47.624] D (197938) NimBLE: 0x00 [0m [17:42:47.624] D (197938) NimBLE: [17:42:47.624] [0m [17:42:47.624] D (197938) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x000a len=1 [17:42:47.624] [0m [17:42:47.624] D (197948) NimBLE: 0x0a [0m [17:42:47.624] D (197948) NimBLE: 0x20 [0m [17:42:47.624] D (197948) NimBLE: 0x01 [0m [17:42:47.624] D (197958) NimBLE: 0x01 [0m [17:42:47.624] D (197958) NimBLE: [17:42:47.624] [0m [17:42:47.624] D (197958) protocomm_nimble: Minimum free heap size = 125188, free Heap size = 136116[0m [17:42:47.624]

`

perseverance51 avatar Apr 30 '23 09:04 perseverance51

Below is the phone and Bluetooth information used

20230430174931

20230430175340

perseverance51 avatar Apr 30 '23 09:04 perseverance51

@perseverance51 , we have never seen this issue and can't even reproduce and so, it is hard to debug. Have you tried changing either the phone or the board?

shahpiyushv avatar May 09 '23 07:05 shahpiyushv