kike-canaries / canairio_firmware

CanAirIO is a citizen science initiative. We are developing a mobile application that is able to set a PM2.5 or CO2 sensors, and other related sensors, as a fixed station using WiFi or mobile station with an smartphone by using a Bluetooth connection.
https://canair.io
GNU General Public License v3.0
104 stars 23 forks source link

BTLE fails on some S3 devices #276

Open hpsaturn opened 6 months ago

hpsaturn commented 6 months ago

Overview

Testing S3 flavors with Android 14 and BLE, I found the next exception after config request:


  #0  0x4038532c:0x3fcbcfe0 in compare_and_set_native at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_hw_support/include/soc/compare_set.h:25
      (inlined by) spinlock_acquire at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_hw_support/include/soc/spinlock.h:103
      (inlined by) xPortEnterCriticalTimeout at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/port/xtensa/port.c:301
  #1  0x40387c41:0x3fcbd020 in vPortEnterCritical at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/port/xtensa/include/freertos/portmacro.h:578 (discriminator 1)
      (inlined by) multi_heap_internal_lock at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap.c:142 (discriminator 1)
  #2  0x40387d9d:0x3fcbd040 in multi_heap_malloc at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap_poisoning.c:233
      (inlined by) multi_heap_malloc at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap_poisoning.c:223
  #3  0x40378553:0x3fcbd060 in heap_caps_malloc_base at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:175
      (inlined by) heap_caps_malloc_base at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:120
  #4  0x4037871d:0x3fcbd090 in heap_caps_realloc_base at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:396
  #5  0x4037887d:0x3fcbd0c0 in heap_caps_realloc at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:465
  #6  0x403788ab:0x3fcbd0e0 in heap_caps_realloc_default at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:253
  #7  0x40388155:0x3fcbd100 in realloc at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/heap.c:34
  #8  0x420242ab:0x3fcbd120 in String::changeBuffer(unsigned int) at /home/avp/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.cpp:200 (discriminator 4)
  #9  0x42024320:0x3fcbd160 in String::reserve(unsigned int) at /home/avp/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.cpp:165 (discriminator 4)
  #10 0x42024359:0x3fcbd180 in String::copy(char const*, unsigned int) at /home/avp/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.cpp:224
  #11 0x420244e7:0x3fcbd1a0 in String::operator=(String const&) at /home/avp/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.cpp:268
  #12 0x4202450b:0x3fcbd1c0 in String::String(String const&) at /home/avp/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.cpp:47
  #13 0x420fedd9:0x3fcbd1e0 in Preferences::getString(char const*, String) at /home/avp/.platformio/packages/framework-arduinoespressif32/libraries/Preferences/src/Preferences.cpp:479
  #14 0x4201bc95:0x3fcbd210 in ConfigApp::getCurrentConfig() at /home/avp/pio/canairio_firmware/lib/configlib/ConfigApp.cpp:75 (discriminator 3)
  #15 0x42003a0b:0x3fcbd770 in bleServerConfigRefresh() at /home/avp/pio/canairio_firmware/src/bluetooth.cpp:63
  #16 0x42003a7f:0x3fcbd7c0 in MyConfigCallbacks::onRead(BLECharacteristic*) at /home/avp/pio/canairio_firmware/src/bluetooth.cpp:94
  #17 0x4212c81f:0x3fcbd7e0 in BLECharacteristicCallbacks::onRead(BLECharacteristic*, esp_ble_gatts_cb_param_t*) at /home/avp/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.cpp:770
  #18 0x4201dd52:0x3fcbd800 in BLECharacteristic::handleGATTServerEvent(esp_gatts_cb_event_t, unsigned char, esp_ble_gatts_cb_param_t*) at /home/avp/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.cpp:395
  #19 0x42022245:0x3fcbdab0 in BLECharacteristicMap::handleGATTServerEvent(esp_gatts_cb_event_t, unsigned char, esp_ble_gatts_cb_param_t*) at /home/avp/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristicMap.cpp:87 (discriminator 2)
  #20 0x42020861:0x3fcbdad0 in BLEService::handleGATTServerEvent(esp_gatts_cb_event_t, unsigned char, esp_ble_gatts_cb_param_t*) at /home/avp/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/BLEService.cpp:362
  #21 0x42020c5d:0x3fcbdb20 in BLEServiceMap::handleGATTServerEvent(esp_gatts_cb_event_t, unsigned char, esp_ble_gatts_cb_param_t*) at /home/avp/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/BLEServiceMap.cpp:93 (discriminator 2)
  #22 0x4202015d:0x3fcbdb40 in BLEServer::handleGATTServerEvent(esp_gatts_cb_event_t, unsigned char, esp_ble_gatts_cb_param_t*) at /home/avp/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/BLEServer.cpp:279
  #23 0x4201e9e1:0x3fcbdba0 in BLEDevice::gattServerEventHandler(esp_gatts_cb_event_t, unsigned char, esp_ble_gatts_cb_param_t*) at /home/avp/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/BLEDevice.cpp:123
  #24 0x420592d2:0x3fcbdbc0 in btc_gatts_cb_to_app at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gatts.c:38
  #25 0x42059e51:0x3fcbdbe0 in btc_gatts_cb_handler at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gatts.c:961
  #26 0x4207b925:0x3fcbdc30 in btc_thread_handler at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/bt/common/btc/core/btc_task.c:203
  #27 0x4207dc03:0x3fcbdc50 in osi_thread_run at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/bt/common/osi/thread.c:165