espressif / esp-iot-solution

Espressif IoT Library. IoT Device Drivers, Documentations and Solutions.
Apache License 2.0
1.96k stars 780 forks source link

IOT button events get stuck when disabling GATTs (AEGHB-836) #411

Open MR-VENOM opened 1 month ago

MR-VENOM commented 1 month ago

Answers checklist.

IDF version.

v5.2.1

Espressif SoC revision.

ESP32-S3 (QFN56) (revision v0.1)

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

Custom board

Steps to reproduce.

  1. Create a example project with GATT server
  2. Add IOT button components to the project
  3. Configure the button to start and stop ble.
  4. Trigger the button to enable the ble and Trigger it back to disable .

gatts_demo.c sdkconfig

Console Logs.

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3810,len:0x178c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xcbc
load:0x403cc700,len:0x2da0
entry 0x403c9914
I (26) boot: ESP-IDF v5.2.1-dirty 2nd stage bootloader
I (27) boot: compile time Oct  5 2024 14:18:51
I (27) boot: Multicore bootloader
I (30) boot: chip revision: v0.1
I (34) boot.esp32s3: Boot SPI Speed : 80MHz
I (39) boot.esp32s3: SPI Mode       : DIO
I (44) boot.esp32s3: SPI Flash Size : 2MB
I (48) boot: Enabling RNG early entropy source...
I (54) boot: Partition Table:
I (57) boot: ## Label            Usage          Type ST Offset   Length
I (65) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (72) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (79) boot:  2 factory          factory app      00 00 00010000 00100000
I (87) boot: End of partition table
I (91) esp_image: segment 0: paddr=00010020 vaddr=3c080020 size=26164h (156004) map
I (128) esp_image: segment 1: paddr=0003618c vaddr=3fc97300 size=03f30h ( 16176) load
I (132) esp_image: segment 2: paddr=0003a0c4 vaddr=40374000 size=05f54h ( 24404) load
I (139) esp_image: segment 3: paddr=00040020 vaddr=42000020 size=7fe38h (523832) map
I (236) esp_image: segment 4: paddr=000bfe60 vaddr=40379f54 size=0d2fch ( 54012) load
I (248) esp_image: segment 5: paddr=000cd164 vaddr=600fe010 size=00004h (     4) load
I (257) boot: Loaded app from partition at offset 0x10000
I (257) boot: Disabling RNG early entropy source...
I (268) cpu_start: Multicore app
I (278) cpu_start: Pro cpu start user code
I (278) cpu_start: cpu freq: 160000000 Hz
I (278) cpu_start: Application information:
I (281) cpu_start: Project name:     button-ble-test
I (287) cpu_start: App version:      1
I (291) cpu_start: Compile time:     Oct  5 2024 14:18:43
I (297) cpu_start: ELF file SHA256:  840c2b3d1...
I (302) cpu_start: ESP-IDF:          v5.2.1-dirty
I (308) cpu_start: Min chip rev:     v0.0
I (313) cpu_start: Max chip rev:     v0.99 
I (317) cpu_start: Chip rev:         v0.1
I (322) heap_init: Initializing. RAM available for dynamic allocation:
I (329) heap_init: At 3FC9F430 len 0004A2E0 (296 KiB): RAM
I (335) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
I (342) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (348) heap_init: At 600FE014 len 00001FD4 (7 KiB): RTCRAM
I (355) spi_flash: detected chip: generic
I (359) spi_flash: flash io: dio
W (363) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (376) sleep: Configure to isolate all GPIO pins in sleep state
I (383) sleep: Enable automatic switching of GPIO sleep configuration
I (390) coexist: coex firmware version: 77cd7f8
I (395) coexist: coexist rom version e7ae62f
I (400) main_task: Started on CPU0
I (410) main_task: Calling app_main()
I (430) button: IoT Button Version: 3.3.1
I (430) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (430) button: IoT Button Version: 3.3.1
I (430) gpio: GPIO[37]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (440) main_task: Returned from app_main()
I (4360) GATTS_DEMO: BTN1: BUTTON_PRESS_DOWN
Press Down 
I (5860) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_START
I (5880) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1520],count is [1]
I (5900) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1540],count is [2]
I (5920) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1560],count is [3]
I (5940) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1580],count is [4]
I (5960) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1600],count is [5]
I (5980) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1620],count is [6]
I (6000) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1640],count is [7]
I (6020) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1660],count is [8]
I (6040) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1680],count is [9]
I (6060) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1700],count is [10]
I (6080) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1720],count is [11]
I (6100) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1740],count is [12]
I (6120) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1760],count is [13]
I (6140) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1780],count is [14]
I (6160) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1800],count is [15]
I (6180) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1820],count is [16]
I (6200) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1840],count is [17]
I (6220) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1860],count is [18]
I (6240) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1880],count is [19]
I (6260) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1900],count is [20]
I (6280) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1920],count is [21]
I (6300) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1940],count is [22]
I (6320) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1960],count is [23]
I (6340) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[1980],count is [24]
I (6360) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2000],count is [25]
I (6380) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2020],count is [26]
I (6400) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2040],count is [27]
I (6420) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2060],count is [28]
I (6440) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2080],count is [29]
I (6460) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2100],count is [30]
I (6480) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2120],count is [31]
I (6500) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2140],count is [32]
I (6520) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2160],count is [33]
I (6540) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2180],count is [34]
I (6560) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2200],count is [35]
I (6580) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2220],count is [36]
I (6600) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2240],count is [37]
I (6620) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2260],count is [38]
I (6640) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2280],count is [39]
I (6660) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2300],count is [40]
I (6680) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2320],count is [41]
I (6700) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2340],count is [42]
I (6720) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2360],count is [43]
I (6740) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2380],count is [44]
I (6760) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2400],count is [45]
I (6780) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2420],count is [46]
I (6800) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2440],count is [47]
I (6820) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2460],count is [48]
I (6840) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2480],count is [49]
I (6860) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2500],count is [50]
I (6880) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2520],count is [51]
I (6900) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2540],count is [52]
I (6920) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2560],count is [53]
I (6940) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2580],count is [54]
I (6960) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2600],count is [55]
I (6980) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2620],count is [56]
I (7000) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2640],count is [57]
I (7020) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2660],count is [58]
I (7040) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2680],count is [59]
I (7060) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2700],count is [60]
I (7080) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2720],count is [61]
I (7100) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2740],count is [62]
I (7120) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2760],count is [63]
I (7140) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2780],count is [64]
I (7160) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2800],count is [65]
I (7180) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2820],count is [66]
I (7200) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2840],count is [67]
I (7220) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2860],count is [68]
I (7240) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2880],count is [69]
I (7260) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2900],count is [70]
I (7280) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2920],count is [71]
I (7300) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2940],count is [72]
I (7320) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2960],count is [73]
I (7340) GATTS_DEMO: BTN1: BUTTON_LONG_PRESS_HOLD[2980],count is [74]
I (11970) GATTS_DEMO: BTN1: BUTTON_PRESS_DOWN
Press Down 
E (11970) GATTS_DEMO: Stopping BLE
E (11970) BT_APPL: application not registered.
W (11980) BT_APPL: bta_dm_disable BTA_DISABLE_DELAY set to 200 ms

More Information.

The button is a switch which can go on and off

lijunru-hub commented 1 week ago

Have you performed a blocking operation in the button callback?