espressif / esp-nimble

A fork of NimBLE stack, for use with ESP32 and ESP-IDF
Apache License 2.0
78 stars 51 forks source link

GATT CONN FAIL ESTABILISH on esp32 C3 #73

Open adlemx opened 1 month ago

adlemx commented 1 month ago

I run the standard example from esp-idf-v5.3\examples\bluetooth\nimble\bleh when I try to connect to esp from the nRF connect, it immediately after the connection starts disconnects with the Error 62 (0x3e): GATT CONN FAIL ESTABLISH

I use ESP32 C3 super mini and esp-idf 5.3

Logs from nrf connect:

nRF Connect, 2024-08-07
BLEHR_SENSOR_1.0 (48:XX:XX:XX:XX:XX)
V 23:57:18.108 Connecting to 48:XX:XX:XX:XX:XX...
D 23:57:18.109 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
D 23:57:18.575 [Callback] Connection state changed with status: 62 and new state: DISCONNECTED (0)
E 23:57:18.575 Error 62 (0x3e): GATT CONN FAIL ESTABLISH
I 23:57:18.575 Disconnected
rahult-github commented 1 month ago

Hi @adlemx ,

Error code 3E, implies connection failed due to sync issues.

CONNECTION FAILED TO BE ESTABLISHED / SYNCHRONIZATION TIMEOUT (0x3E) The Connection Failed to be Established / Synchronization Timeout error code indicates that the LL initiated a connection or initiated synchronization to periodic advertising but the connection has failed to be established or the Link Layer failed to synchronize with the periodic advertising within 6 periodic advertising events of the first attempt.

So, this can be due to environment reasons . However, you can try to enable BT_NIMBLE_ENABLE_CONN_REATTEMPT in menuconfig, which basically will attempt to re-connect if disconnection is due to reason 0x3E.

Also the value BT_NIMBLE_MAX_CONN_REATTEMPT can be changed to decide how many times this re-attempt for connection is to be done, which can be increased as per user's need.

So please give this a try.

adlemx commented 1 month ago

@rahult-github thanks for the answer. I already had BT_NIMBLE_ENABLE_CONN_REATTEMPT enabled. I tried setting BT_NIMBLE_MAX_CONN_REATTEMPT to 255, but there was no change. I also tried from another phone, and there was a different error (Error 133 (0x85): GATT ERROR), or is it the same thing?

rahult-github commented 1 month ago

Hello @adlemx ,

So you tried for 255 times for same result ? May i request you to please share esp device side console logs ?

adlemx commented 1 month ago

@rahult-github, Yes, of course, here are the logs from the ESP, but it seems to me that there is nothing useful in it because during connection attempts nothing new appears in the logs

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x4004c98c
0x4004c98c: usb_uart_rx_one_char in ROM

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5820,len:0x1738
load:0x403cc710,len:0xb9c
load:0x403ce710,len:0x2e4c
entry 0x403cc71a
I (24) boot: ESP-IDF v5.3 2nd stage bootloader
I (24) boot: compile time Aug  9 2024 12:57:27
I (25) boot: chip revision: v0.4
I (27) boot.esp32c3: SPI Speed      : 80MHz
I (32) boot.esp32c3: SPI Mode       : DIO
I (37) boot.esp32c3: SPI Flash Size : 2MB
I (41) boot: Enabling RNG early entropy source...
I (47) boot: Partition Table:
I (50) boot: ## Label            Usage          Type ST Offset   Length
I (58) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (65) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (73) boot:  2 factory          factory app      00 00 00010000 00100000
I (80) boot: End of partition table
I (84) esp_image: segment 0: paddr=00010020 vaddr=3c050020 size=10be4h ( 68580) map
I (103) esp_image: segment 1: paddr=00020c0c vaddr=3fc92a00 size=02890h ( 10384) load
I (106) esp_image: segment 2: paddr=000234a4 vaddr=40380000 size=0cb74h ( 52084) load
I (119) esp_image: segment 3: paddr=00030020 vaddr=42000020 size=4d7ech (317420) map
I (169) esp_image: segment 4: paddr=0007d814 vaddr=4038cb74 size=05ca0h ( 23712) load
I (180) boot: Loaded app from partition at offset 0x10000
I (180) boot: Disabling RNG early entropy source...
V (192) mmap: after coalescing, 1 regions are left
I (192) cpu_start: Unicore app
D (192) cpu_start: Pro cpu up
D (200) clk: RTC_SLOW_CLK calibration value: 3509261
V CACHE_ERR: access error intr clr & ena mask is: 0x3f
V CACHE_ERR: illegal error intr clr & ena mask is: 0x23
D (209) cpu_start: calling init function: 0x42000236 on core: 0
0x42000236: __esp_system_init_fn_init_efuse_check at C:/Espressif/frameworks/esp-idf-v5.3/components/efuse/src/esp_efuse_startup.c:31

D (213) cpu_start: calling init function: 0x42000954 on core: 0
0x42000954: __esp_system_init_fn_init_show_cpu_freq at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_system/startup_funcs.c:58

I (219) cpu_start: Pro cpu start user code
I (224) cpu_start: cpu freq: 160000000 Hz
D (228) cpu_start: calling init function: 0x420000e0 on core: 0
0x420000e0: __esp_system_init_fn_init_show_app_info at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_app_format/esp_app_desc.c:104

I (234) app_init: Application information:
I (239) app_init: Project name:     blehr
I (244) app_init: App version:      v5.3
I (248) app_init: Compile time:     Aug  9 2024 12:57:20
I (254) app_init: ELF file SHA256:  3cf771639...
I (260) app_init: ESP-IDF:          v5.3
D (264) cpu_start: calling init function: 0x42000248 on core: 0
0x42000248: __esp_system_init_fn_init_efuse_show_app_info at C:/Espressif/frameworks/esp-idf-v5.3/components/efuse/src/esp_efuse_startup.c:41

I (270) efuse_init: Min chip rev:     v0.3
I (275) efuse_init: Max chip rev:     v1.99
I (280) efuse_init: Chip rev:         v0.4
D (285) cpu_start: calling init function: 0x420026f8 on core: 0
0x420026f8: __esp_system_init_fn_init_heap at C:/Espressif/frameworks/esp-idf-v5.3/components/heap/heap_caps_init.c:25

V (291) memory_layout: reserved range is 0x3c060b2c - 0x3c060b4c
D (297) memory_layout: Checking 5 reserved memory ranges:
D (302) memory_layout: Reserved memory range 0x3fc80000 - 0x3fc92a00
D (309) memory_layout: Reserved memory range 0x3fc92a00 - 0x3fc97930
D (315) memory_layout: Reserved memory range 0x3fcdf060 - 0x3fce0000
D (322) memory_layout: Reserved memory range 0x50000000 - 0x50000200
D (328) memory_layout: Reserved memory range 0x50001fe8 - 0x50002000
D (334) memory_layout: Building list of available memory regions:
V (341) memory_layout: Examining memory region 0x3fc80000 - 0x3fca0000
V (347) memory_layout: Start of region 0x3fc80000 - 0x3fca0000 overlaps reserved 0x3fc80000 - 0x3fc92a00
V (357) memory_layout: Start of region 0x3fc92a00 - 0x3fca0000 overlaps reserved 0x3fc92a00 - 0x3fc97930
D (366) memory_layout: Available memory region 0x3fc97930 - 0x3fca0000
V (373) memory_layout: Examining memory region 0x3fca0000 - 0x3fcc0000
D (379) memory_layout: Available memory region 0x3fca0000 - 0x3fcc0000
V (386) memory_layout: Examining memory region 0x3fcc0000 - 0x3fcdc710
D (393) memory_layout: Available memory region 0x3fcc0000 - 0x3fcdc710
V (399) memory_layout: Examining memory region 0x3fcdc710 - 0x3fce0000
V (406) memory_layout: End of region 0x3fcdc710 - 0x3fce0000 overlaps reserved 0x3fcdf060 - 0x3fce0000
D (415) memory_layout: Available memory region 0x3fcdc710 - 0x3fcdf060
V (422) memory_layout: Examining memory region 0x50000000 - 0x50002000
V (428) memory_layout: Start of region 0x50000000 - 0x50002000 overlaps reserved 0x50000000 - 0x50000200
V (438) memory_layout: End of region 0x50000200 - 0x50002000 overlaps reserved 0x50001fe8 - 0x50002000
D (447) memory_layout: Available memory region 0x50000200 - 0x50001fe8
I (454) heap_init: Initializing. RAM available for dynamic allocation:
D (461) heap_init: New heap initialised at 0x3fc97930
I (466) heap_init: At 3FC97930 len 000286D0 (161 KiB): RAM
D (472) heap_init: New heap initialised at 0x3fcc0000
I (477) heap_init: At 3FCC0000 len 0001C710 (113 KiB): Retention RAM
I (485) heap_init: At 3FCDC710 len 00002950 (10 KiB): Retention RAM
D (491) heap_init: New heap initialised at 0x50000200
I (497) heap_init: At 50000200 len 00001DE8 (7 KiB): RTCRAM
D (503) cpu_start: calling init function: 0x42005eb6 on core: 0
0x42005eb6: __esp_system_init_fn_esp_timer_init_nonos at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_timer/src/esp_timer_init.c:28

D (509) cpu_start: calling init function: 0x420054b6 on core: 0
0x420054b6: __esp_system_init_fn_init_newlib at C:/Espressif/frameworks/esp-idf-v5.3/components/newlib/newlib_init.c:162

D (515) cpu_start: calling init function: 0x420009cc on core: 0
0x420009cc: __esp_system_init_fn_init_brownout at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_system/startup_funcs.c:67

V (521) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (527) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x40E
D (535) intr_alloc: Connected src 27 to int 2 (cpu 0)
D (540) cpu_start: calling init function: 0x420009da on core: 0
0x420009da: __esp_system_init_fn_init_newlib_time at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_system/startup_funcs.c:81

D (546) cpu_start: calling init function: 0x4200730a on core: 0
0x4200730a: __esp_system_init_fn_init_vfs_uart at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_driver_uart/src/uart_vfs.c:1080

D (552) cpu_start: calling init function: 0x420083ae on core: 0
0x420083ae: __esp_system_init_fn_init_vfs_usj_sec at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_driver_usb_serial_jtag/src/usb_serial_jtag_vfs.c:404

D (558) cpu_start: calling init function: 0x4200863a on core: 0
0x4200863a: __esp_system_init_fn_init_vfs_console at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_vfs_console/vfs_console.c:222

D (564) cpu_start: calling init function: 0x42005552 on core: 0
0x42005552: __esp_system_init_fn_init_newlib_stdio at C:/Espressif/frameworks/esp-idf-v5.3/components/newlib/newlib_init.c:207

D (571) cpu_start: calling init function: 0x42005a92 on core: 0
0x42005a92: __esp_system_init_fn_init_pthread at C:/Espressif/frameworks/esp-idf-v5.3/components/pthread/pthread.c:76

D (576) cpu_start: calling init function: 0x420009ea on core: 0
0x420009ea: __esp_system_init_fn_init_flash at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_system/startup_funcs.c:88

V (582) memspi: raw_chip_id: 164020

V (586) memspi: chip_id: 204016

V (589) memspi: raw_chip_id: 164020

V (593) memspi: chip_id: 204016

D (597) spi_flash: trying chip: issi
D (600) spi_flash: trying chip: gd
D (604) spi_flash: trying chip: mxic
D (607) spi_flash: trying chip: winbond
D (611) spi_flash: trying chip: boya
D (615) spi_flash: trying chip: th
D (618) spi_flash: trying chip: generic
I (622) spi_flash: detected chip: generic
I (627) spi_flash: flash io: dio
W (631) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
D (644) cpu_start: calling init function: 0x42000320 on core: 0
D (650) cpu_start: calling init function: 0x42038ffa
0x42000320: __esp_system_init_fn_init_efuse at C:/Espressif/frameworks/esp-idf-v5.3/components/efuse/src/esp_efuse_startup.c:137

0x42038ffa: _GLOBAL__sub_I__ZN10__cxxabiv111__terminateEPFvvE at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc_zicsr_zifencei/ilp32/no-rtti/libstdc++-v3/include/riscv32-esp-elf/bits/gthr-default.h:733
 (inlined by) __gnu_cxx::__mutex::__mutex() at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc_zicsr_zifencei/ilp32/no-rtti/libstdc++-v3/include/ext/concurrence.h:132
 (inlined by) __static_initialization_and_destruction_0 at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:37
 (inlined by) _GLOBAL__sub_I__ZN10__cxxabiv111__terminateEPFvvE at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:133

D (655) cpu_start: calling init function: 0x42038f7e
0x42038f7e: _GLOBAL__sub_I__ZN17__eh_globals_init7_S_initE at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc_zicsr_zifencei/ilp32/no-rtti/libstdc++-v3/include/riscv32-esp-elf/bits/gthr-default.h:708
 (inlined by) __eh_globals_init::__eh_globals_init() at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_globals.cc:105
 (inlined by) __static_initialization_and_destruction_0 at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_globals.cc:126
 (inlined by) _GLOBAL__sub_I__ZN17__eh_globals_init7_S_initE at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_globals.cc:162

D (660) cpu_start: calling init function: 0x42038ac2
0x42038ac2: _GLOBAL__sub_I__ZSt7nothrow at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc_zicsr_zifencei/ilp32/no-rtti/libstdc++-v3/include/riscv32-esp-elf/bits/gthr-default.h:733
 (inlined by) __gnu_cxx::__mutex::__mutex() at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc_zicsr_zifencei/ilp32/no-rtti/libstdc++-v3/include/ext/concurrence.h:132
 (inlined by) __static_initialization_and_destruction_0 at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/new_handler.cc:33
 (inlined by) _GLOBAL__sub_I__ZSt7nothrow at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/new_handler.cc:71

D (665) cpu_start: calling init function: 0x403897e2
0x403897e2: enable_timer_group0_for_calibration at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_hw_support/port/esp32c3/rtc_time.c:200

D (670) cpu_start: calling init function: 0x42000fee
0x42000fee: esp_reset_reason_init at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_system/port/soc/esp32c3/reset_reason.c:66

D (675) cpu_start: calling init function: 0x42032048 on core: 0
0x42032048: __esp_system_init_fn_esp_timer_init_os at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_timer/src/esp_timer.c:587

V (681) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (688) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xC02
D (696) intr_alloc: Connected src 39 to int 3 (cpu 0)
D (701) cpu_start: calling init function: 0x42001ec6 on core: 0
0x42001ec6: __esp_system_init_fn_esp_hw_stack_guard_init at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_system/hw_stack_guard.c:15

D (707) cpu_start: calling init function: 0x420039a0 on core: 0
0x420039a0: __esp_system_init_fn_esp_sleep_startup_init at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_hw_support/sleep_gpio.c:185

I (713) sleep: Configure to isolate all GPIO pins in sleep state
I (720) sleep: Enable automatic switching of GPIO sleep configuration
D (727) cpu_start: calling init function: 0x42000a2c on core: 0
0x42000a2c: __esp_system_init_fn_init_apb_dma at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_system/startup_funcs.c:125

D (733) cpu_start: calling init function: 0x42000a3a on core: 0
0x42000a3a: __esp_system_init_fn_init_coexist at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_system/startup_funcs.c:134

I (739) coexist: coex firmware version: dab85ae96
I (744) coexist: coexist rom version 9387209
D (749) cpu_start: calling init function: 0x42007efa on core: 0
0x42007efa: __esp_system_init_fn_usb_serial_jtag_conn_status_init at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_driver_usb_serial_jtag/src/usb_serial_jtag_connection_monitor.c:75

D (755) cpu_start: calling init function: 0x42000a52 on core: 0
0x42000a52: __esp_system_init_fn_init_disable_rtc_wdt at C:/Espressif/frameworks/esp-idf-v5.3/components/esp_system/startup_funcs.c:143

V (761) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (767) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x40E
D (775) intr_alloc: Connected src 50 to int 4 (cpu 0)
D (780) app_start: Starting scheduler on CPU0
V (785) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (785) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x402
D (785) intr_alloc: Connected src 37 to int 7 (cpu 0)
I (785) main_task: Started on CPU0
D (785) heap_init: New heap initialised at 0x3fcdc710
V (785) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (795) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (805) intr_alloc: Connected src 33 to int 9 (cpu 0)
I (805) main_task: Calling app_main()
V (815) partition: Loading the partition table
V (815) mmap: actual_mapped_len is 0x10000
V (825) calculated md5: 0x3fc9a7d8   f4 ad 4f 45 38 56 4b 5d  74 35 b6 2c 75 b6 95 24  |..OE8VK]t5.,u..$|
V (835) stored md5: 0x3c078070   f4 ad 4f 45 38 56 4b 5d  74 35 b6 2c 75 b6 95 24  |..OE8VK]t5.,u..$|
V (845) partition: Partition table MD5 verified
I (845) BLE_INIT: BT controller compile version [ba3b3e3]
D (855) efuse: In EFUSE_BLK1__DATA1_REG is used 8 bits starting with 8 bit
D (855) efuse: In EFUSE_BLK1__DATA1_REG is used 8 bits starting with 0 bit
D (865) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 24 bit
D (875) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 16 bit
D (875) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 8 bit
D (885) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 0 bit
I (895) BLE_INIT: Bluetooth MAC: 48:XX:XX:XX:XX:8a
I (895) phy_init: phy_version 1180,01f2a49,Jun  4 2024,16:34:25
D (905) phy_init: loading PHY init data from application binary
D (915) nvs: nvs_open_from_partition phy 0
D (915) nvs: nvs_get cal_version 4
V (915) phy_init: phy_get_rf_cal_version: 1180
D (925) nvs: nvs_get_str_or_blob cal_mac
D (925) efuse: In EFUSE_BLK1__DATA1_REG is used 8 bits starting with 8 bit
D (935) efuse: In EFUSE_BLK1__DATA1_REG is used 8 bits starting with 0 bit
D (945) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 24 bit
D (945) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 16 bit
D (955) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 8 bit
D (965) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 0 bit
D (965) nvs: nvs_get_str_or_blob cal_data
D (975) nvs: nvs_close 1
D (975) efuse: In EFUSE_BLK1__DATA1_REG is used 8 bits starting with 8 bit
D (985) efuse: In EFUSE_BLK1__DATA1_REG is used 8 bits starting with 0 bit
D (985) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 24 bit
D (995) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 16 bit
D (1005) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 8 bit
D (1015) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 0 bit
D (1035) temperature_sensor: range changed, change to index 2
W (1055) phy_init: saving new calibration data because of checksum failure, mode(0)
D (1055) nvs: nvs_open_from_partition phy 1
D (1055) nvs: nvs_set_blob cal_data 1904
D (1075) efuse: In EFUSE_BLK1__DATA1_REG is used 8 bits starting with 8 bit
D (1075) efuse: In EFUSE_BLK1__DATA1_REG is used 8 bits starting with 0 bit
D (1085) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 24 bit
D (1085) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 16 bit
D (1095) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 8 bit
D (1105) efuse: In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 0 bit
D (1105) nvs: nvs_set_blob cal_mac 6
V (1115) phy_init: phy_get_rf_cal_version: 1180
D (1115) nvs: nvs_set cal_version 4 1180
D (1125) nvs: nvs_close 2
D (1125) nvs: nvs_open_from_partition cache_addr_tab 1
D (1125) nvs: nvs_get_str_or_blob gattc_cache_key
D (1135) NimBLE: ble_gattc_cache_init, Line = 694, storage flash get blob data fail, err_code = 0x1102
I (1145) NimBLE_BLE_HeartRate: BLE Host Task Started
D (1145) NimBLE: ble_hs_hci_cmd_send: ogf=0x03 ocf=0x0003 len=0

D (1155) NimBLE: 0x03
D (1155) NimBLE: 0x0c
D (1165) NimBLE: 0x00
D (1165) NimBLE:

D (1165) NimBLE: ble_hs_hci_cmd_send: ogf=0x04 ocf=0x0001 len=0

D (1175) NimBLE: 0x01
D (1175) NimBLE: 0x10
D (1175) NimBLE: 0x00
D (1175) NimBLE:

D (1185) NimBLE: ble_hs_hci_cmd_send: ogf=0x04 ocf=0x0003 len=0

D (1185) NimBLE: 0x03
D (1185) NimBLE: 0x10
D (1195) NimBLE: 0x00
D (1195) NimBLE:

D (1195) NimBLE: ble_hs_hci_cmd_send: ogf=0x03 ocf=0x0001 len=8

D (1205) NimBLE: 0x01
D (1205) NimBLE: 0x0c
D (1205) NimBLE: 0x08
D (1205) NimBLE: 0x90
D (1215) NimBLE: 0x80
D (1215) NimBLE: 0x00
D (1215) NimBLE: 0x02
D (1215) NimBLE: 0x00
D (1225) NimBLE: 0x80
D (1225) NimBLE: 0x00
D (1225) NimBLE: 0x20
D (1225) NimBLE:

D (1235) NimBLE: ble_hs_hci_cmd_send: ogf=0x03 ocf=0x0063 len=8

D (1235) NimBLE: 0x63
D (1235) NimBLE: 0x0c
D (1245) NimBLE: 0x08
D (1245) NimBLE: 0x00
D (1245) NimBLE: 0x00
D (1245) NimBLE: 0x80
D (1255) NimBLE: 0x00
D (1255) NimBLE: 0x00
D (1255) NimBLE: 0x00
D (1255) NimBLE: 0x00
D (1265) NimBLE: 0x00
D (1265) NimBLE:

D (1265) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0001 len=8

D (1275) NimBLE: 0x01
D (1275) NimBLE: 0x20
D (1275) NimBLE: 0x08
D (1275) NimBLE: 0x7f
D (1285) NimBLE: 0xfe
D (1285) NimBLE: 0x0f
D (1285) NimBLE: 0x00
D (1285) NimBLE: 0x00
D (1295) NimBLE: 0x00
D (1295) NimBLE: 0x00
D (1295) NimBLE: 0x00
D (1295) NimBLE:

D (1305) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0002 len=0

D (1305) NimBLE: 0x02
D (1305) NimBLE: 0x20
D (1315) NimBLE: 0x00
D (1315) NimBLE:

D (1315) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0003 len=0

D (1325) NimBLE: 0x03
D (1325) NimBLE: 0x20
D (1325) NimBLE: 0x00
D (1335) NimBLE:

D (1335) NimBLE: ble_hs_hci_cmd_send: ogf=0x04 ocf=0x0009 len=0

D (1335) NimBLE: 0x09
D (1345) NimBLE: 0x10
D (1345) NimBLE: 0x00
D (1345) NimBLE:

D (1345) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0018 len=0

D (1355) NimBLE: 0x18
D (1355) NimBLE: 0x20
D (1355) NimBLE: 0x00
D (1365) NimBLE:

D (1365) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0018 len=0

D (1365) NimBLE: 0x18
D (1375) NimBLE: 0x20
D (1375) NimBLE: 0x00
D (1375) NimBLE:

D (1375) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x002d len=1

D (1385) NimBLE: 0x2d
D (1385) NimBLE: 0x20
D (1395) NimBLE: 0x01
D (1395) NimBLE: 0x00
D (1395) NimBLE:

D (1395) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0029 len=0

D (1405) NimBLE: 0x29
D (1405) NimBLE: 0x20
D (1405) NimBLE: 0x00
D (1415) NimBLE:

D (1415) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x002d len=1

D (1415) NimBLE: 0x2d
D (1425) NimBLE: 0x20
D (1425) NimBLE: 0x01
D (1425) NimBLE: 0x01
D (1425) NimBLE:

I (1435) NimBLE: GAP procedure initiated: stop advertising.

D (1435) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x000a len=1

D (1445) NimBLE: 0x0a
D (1445) NimBLE: 0x20
D (1445) NimBLE: 0x01
D (1455) NimBLE: 0x00
D (1455) NimBLE:

D (1455) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0027 len=39

D (1465) NimBLE: 0x27
D (1465) NimBLE: 0x20
D (1465) NimBLE: 0x27
D (1465) NimBLE: 0x00
D (1475) NimBLE: 0x00
D (1475) NimBLE: 0x00
D (1475) NimBLE: 0x00
D (1475) NimBLE: 0x00
D (1485) NimBLE: 0x00
D (1485) NimBLE: 0x00
D (1485) NimBLE: 0x00
D (1485) NimBLE: 0x00
D (1495) NimBLE: 0x00
D (1495) NimBLE: 0x00
D (1495) NimBLE: 0x00
D (1495) NimBLE: 0x00
D (1505) NimBLE: 0x00
D (1505) NimBLE: 0x00
D (1505) NimBLE: 0x00
D (1505) NimBLE: 0x00
D (1515) NimBLE: 0x00
D (1515) NimBLE: 0x00
D (1515) NimBLE: 0x00
D (1515) NimBLE: 0x00
D (1515) NimBLE: 0x00
D (1525) NimBLE: 0x00
D (1525) NimBLE: 0xd6
D (1525) NimBLE: 0x6b
D (1525) NimBLE: 0x1d
D (1535) NimBLE: 0x89
D (1535) NimBLE: 0x6e
D (1535) NimBLE: 0x3d
D (1535) NimBLE: 0x50
D (1545) NimBLE: 0xf5
D (1545) NimBLE: 0xbe
D (1545) NimBLE: 0x01
D (1545) NimBLE: 0x3d
D (1555) NimBLE: 0xa3
D (1555) NimBLE: 0x62
D (1555) NimBLE: 0x7d
D (1555) NimBLE: 0x2b
D (1565) NimBLE: 0x38
D (1565) NimBLE:

D (1565) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x004e len=8

D (1575) NimBLE: 0x4e
D (1575) NimBLE: 0x20
D (1575) NimBLE: 0x08
D (1575) NimBLE: 0x00
D (1585) NimBLE: 0x00
D (1585) NimBLE: 0x00
D (1585) NimBLE: 0x00
D (1585) NimBLE: 0x00
D (1595) NimBLE: 0x00
D (1595) NimBLE: 0x00
D (1595) NimBLE: 0x01
D (1595) NimBLE:

I (1605) NimBLE: Failed to restore IRKs from store; status=8

I (1605) NimBLE: Device Address:
I (1615) NimBLE: 48:XX:XX:XX:XX:8a
I (1615) NimBLE:

D (1615) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0007 len=0

D (1625) NimBLE: 0x07
D (1625) NimBLE: 0x20
D (1625) NimBLE: 0x00
D (1635) NimBLE:

D (1635) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0008 len=32

D (1645) NimBLE: 0x08
D (1645) NimBLE: 0x20
D (1645) NimBLE: 0x20
D (1645) NimBLE: 0x18
D (1645) NimBLE: 0x02
D (1655) NimBLE: 0x01
D (1655) NimBLE: 0x06
D (1655) NimBLE: 0x11
D (1655) NimBLE: 0x09
D (1665) NimBLE: 0x62
D (1665) NimBLE: 0x6c
D (1665) NimBLE: 0x65
D (1665) NimBLE: 0x68
D (1675) NimBLE: 0x72
D (1675) NimBLE: 0x5f
D (1675) NimBLE: 0x73
D (1675) NimBLE: 0x65
D (1685) NimBLE: 0x6e
D (1685) NimBLE: 0x73
D (1685) NimBLE: 0x6f
D (1685) NimBLE: 0x72
D (1695) NimBLE: 0x5f
D (1695) NimBLE: 0x31
D (1695) NimBLE: 0x2e
D (1695) NimBLE: 0x30
D (1705) NimBLE: 0x02
D (1705) NimBLE: 0x0a
D (1705) NimBLE: 0x09
D (1705) NimBLE: 0xfe
D (1715) NimBLE: 0xca
D (1715) NimBLE: 0x3f
D (1715) NimBLE: 0x32
D (1715) NimBLE: 0x40
D (1725) NimBLE: 0x01
D (1725) NimBLE: 0x42
D (1725) NimBLE:

I (1725) NimBLE: GAP procedure initiated: advertise;
I (1735) NimBLE: disc_mode=2
I (1735) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (1745) NimBLE:

D (1745) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0006 len=15

D (1755) NimBLE: 0x06
D (1755) NimBLE: 0x20
D (1765) NimBLE: 0x0f
D (1765) NimBLE: 0x30
D (1765) NimBLE: 0x00
D (1765) NimBLE: 0x60
D (1775) NimBLE: 0x00
D (1775) NimBLE: 0x00
D (1775) NimBLE: 0x00
D (1775) NimBLE: 0x00
D (1775) NimBLE: 0x00
D (1785) NimBLE: 0x00
D (1785) NimBLE: 0x00
D (1785) NimBLE: 0x00
D (1785) NimBLE: 0x00
D (1795) NimBLE: 0x00
D (1795) NimBLE: 0x07
D (1795) NimBLE: 0x00
D (1795) NimBLE:

D (1805) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x000a len=1

D (1805) NimBLE: 0x0a
D (1815) NimBLE: 0x20
D (1815) NimBLE: 0x01
D (1815) NimBLE: 0x01
D (1815) NimBLE:

I (1825) main_task: Returned from app_main()
rahult-github commented 1 month ago

Hello @adlemx ,

My apologies as i misread the initiate statement

when I try to connect to esp from the nRF connect

Here nrf is initiator, not esp. So on esp side there will be no connection event received. The reattempt connection feature works if connection is initiated from esp side and connection fails with reason 0x3E.

Here, central device has to initiate connection again, server side doesn't have any control . In logs also, esp side is advertising continuously.

adlemx commented 1 month ago

@rahult-github I tried sketches from examples\bluetooth\bluedroid\ble_50\ble50_security_server and from examples\bluetooth\bluedroid\ble\gatt_security_server. The example with ble 5.0 works, but just ble gives the same error. Is it possible to make nimble work only with ble 5.0? Enable BLE 5 feature is enabled in the config menu, but apparently it still uses bluetooth 4.2

rahult-github commented 1 month ago

@adlemx , they are different stacks and hence different examples. For equivalent example, you can refer to examples/bluetooth/nimble/bleprph ?

adlemx commented 1 month ago

@rahult-github This example also does not work, could it be a problem with the quartz on the board? And is it possible to switch the ESP to internal clocking?