Heltec-Aaron-Lee / WiFi_Kit_series

Arduino source codes and toolchain for WiFi_Kit_series made by HelTecAutomation.
GNU Lesser General Public License v2.1
730 stars 304 forks source link

getServices() causes a crash on a Polar H10 Heart Rate Monitor... but nothing else #239

Open leegs opened 4 months ago

leegs commented 4 months ago

I am trying to pair a Heltec Wireless Stick (V3) to a Polar H10 Heart Rate Monitor and get a crash when calling getServices(). This happens on the example BLEScan and BLEClient examples without any alteration (save the Service UUID of 0x180D and Characteristic UUID of 0x2A37 for the BLEClient example).

I did not have the heart rate monitor when I got the HelTec device, so I familiarized myself with the API by altering the BLEScan example to connect to every address it found to getServices() from each device and getCharacteristics() from each service similar to BLEClient. I ran it in many public places while figuring it out and probably connected to several hundred devices and it worked without a crash.

When the Polar H10 became available, the program immediately crashed. This is a bit of a problem as that is the device I specifically need to use.

The complete serial log with CORE_DEBUG_LEVEL set to VERBOSE from boot to reboot is included at the end of the post. The BLEScan I have been using is unchanged except for the service and characteristic UUIDs and a few Serial.println() calls used to isolate the crash. Nothing of substance is changed. Directly below is an excerpt from BLEScan where the service and characteristic UUIDs are set for the heart rate monitor.

// The remote service we wish to connect to.
static BLEUUID serviceUUID((uint16_t) ESP_GATT_UUID_HEART_RATE_SVC);
// The characteristic of the remote service we are interested in.
static BLEUUID    charUUID((uint16_t) ESP_GATT_HEART_RATE_MEAS);

It is only possible to verify the serviceUUID is working as expected since the sketch does connect to the Polar H10 as soon as it is found, but does not get past getServices(). The serviceUUID does not seem to be the problem, though.

It appears the call to connect() completes, but the next call to getServices() causes the crash. Below is the verbose output from BLEScan during the call to getServices():

08:50:58.655 -> Ask for services
08:50:58.655 -> [  9210][V][BLEClient.cpp:448] getServices(): >> getServices
08:50:58.655 -> [  9211][V][BLEClient.cpp:73] clearServices(): >> clearServices
08:50:58.655 -> [  9215][V][BLEClient.cpp:80] clearServices(): << clearServices
08:50:58.655 -> [  9221][V][FreeRTOS.cpp:189] take(): Semaphore taking: name: SearchCmplEvt (0x3fcf7374), owner: <N/A> for getServices
08:50:58.699 -> [  9231][V][FreeRTOS.cpp:198] take(): Semaphore taken:  name: SearchCmplEvt (0x3fcf7374), owner: getServices
08:50:58.699 -> [  9240][V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: SearchCmplEvt (0x3fcf7374), owner: getServices for getServices
08:51:00.050 -> Guru Meditation Error: Core  0 panic'ed (Unhandled debug exception). 
08:51:00.083 -> Debug exception reason: Stack canary watchpoint triggered (BTU_TASK) 

08:51:00.083 -> Core  0 register dump:
08:51:00.083 -> PC      : 0x4037f9af  PS      : 0x00060f36  A0      : 0x803820c0  A1      : 0x3fcf54f0  
08:51:00.083 -> A2      : 0x3fc9dc0c  A3      : 0xb33fffff  A4      : 0x0000abab  A5      : 0x00060f23  
08:51:00.083 -> A6      : 0x00060f23  A7      : 0x0000cdcd  A8      : 0x0000cdcd  A9      : 0xffffffff  
08:51:00.115 -> A10     : 0x00000000  A11     : 0x00000000  A12     : 0x00000008  A13     : 0x00000008  
08:51:00.115 -> A14     : 0x02c9dc0c  A15     : 0x00ffffff  SAR     : 0x00000020  EXCCAUSE: 0x00000001  
08:51:00.115 -> EXCVADDR: 0x00000000  LBEG    : 0x400570e8  LEND    : 0x400570f3  LCOUNT  : 0xffffffff  
08:51:00.115 -> 
08:51:00.115 -> 
08:51:00.115 -> Backtrace:0x4037f9ac:0x3fcf54f00x403820bd:0x3fcf5530 0x403820ea:0x3fcf5550 0x40382330:0x3fcf5570 0x40377275:0x3fcf5590 0x40377289:0x3fcf55c0 0x403772b9:0x3fcf55e0 0x4038276a:0x3fcf5600 0x40382788:0x3fcf5620 0x42040101:0x3fcf5640 0x4203f8cd:0x3fcf5660 0x420406d9:0x3fcf5680 0x4201f7f9:0x3fcf56a0 0x4201fa75:0x3fcf56c0 0x420205e5:0x3fcf56e0 0x42039895:0x3fcf5700 0x4203a0d6:0x3fcf5720 0x420383c1:0x3fcf5740 0x4204b2cf:0x3fcf5760 0x4204b463:0x3fcf5780 0x4204b592:0x3fcf57a0 0x420300c7:0x3fcf57e0 0x4202f2d9:0x3fcf5a70 0x420446cd:0x3fcf5aa0 0x42044740:0x3fcf5ae0 0x42044b19:0x3fcf5b00 0x42044bad:0x3fcf5d90 0x42044bcb:0x3fcf5db0 0x42044b9b:0x3fcf5dd0 0x42044bcb:0x3fcf5df0 0x42044b9b:0x3fcf5e10 0x42044bcb:0x3fcf5e30 0x42044b9b:0x3fcf5e50 0x42044bcb:0x3fcf5e70 0x42044b9b:0x3fcf5e90 0x42044bcb:0x3fcf5eb0 0x42044b9b:0x3fcf5ed0 0x42044c22:0x3fcf5ef0 0x420355f1:0x3fcf5f10 0x420300fe:0x3fcf61c0 0x420305be:0x3fcf6450 0x420310e9:0x3fcf64b0 0x42032950:0x3fcf6500 0x420329f9:0x3fcf6520 0x4203a709:0x3fcf6540 0x4202dd94:0x3fcf6580 0x42040493:0x3fcf65a0 
08:51:00.213 -> 
08:51:00.213 -> 
08:51:00.213 -> 
08:51:00.213 -> 
08:51:00.213 -> ELF file SHA256: 0000000000000000
08:51:00.213 -> 
08:51:00.213 -> Rebooting...

I tried getService(UUID) but got the same crash. The code for getService(UUID) is very basic and returns an element of m_servicesMap suggesting that may be the problem. That variable is assigned in ESP_GATTC_SEARCH_RES_EVT case in gattClientEventHandler(), but no log messages indicate that section of code is ever executed during connect(). The log indicates the crash happens right where the pointer to m_servicesMap is being passed back from getServices() (and getService(serviceUUID) not shown). Perhaps connect() does not populate m_servicesMap and the crash is a result of attempting to return a pointer to the uninitialized m_servicesMap variable?

This is really difficult to explain, though, since an altered BLEScan sketch connected to possibly hundreds of devices and enumerated all services and characteristics without a single crash before getting Polar H10 implying that m_servicesMap does get populated when connecting to a different device.

Below is the log for the call to connect() that seems to show that the ESP_GATTC_SEARCH_RES_EVT case in gattClientEventHandler() is not reached (but cases for ESP_GATTC_REG_EVT, ESP_GATTC_CONNECT_EVT and ESP_GATTC_OPEN_EVT are).

08:50:58.283 -> Connecting to server
08:50:58.283 -> [  8839][V][BLEClient.cpp:98] connect(): >> connect(cf:28:3f:02:9e:0b)
08:50:58.283 -> [  8839][I][BLEDevice.cpp:622] addPeerDevice(): add conn_id: 0, GATT role: client
08:50:58.283 -> [  8845][V][FreeRTOS.cpp:189] take(): Semaphore taking: name: RegEvt (0x3fcf72ac), owner: <N/A> for connect
08:50:58.314 -> [  8855][V][FreeRTOS.cpp:198] take(): Semaphore taken:  name: RegEvt (0x3fcf72ac), owner: connect
08:50:58.314 -> [  8864][V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: RegEvt (0x3fcf72ac), owner: connect for connect
08:50:58.314 -> [  8864][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_REG_EVT
08:50:58.342 -> [  8884][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_REG_EVT
08:50:58.342 -> [  8892][V][BLEUtils.cpp:1444] dumpGattClientEvent(): [status: ESP_GATT_OK, app_id: 0x0]
08:50:58.342 -> [  8900][D][BLEClient.cpp:178] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_REG_EVT
08:50:58.342 -> [  8910][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: RegEvt (0x3fcf72ac), owner: connect
08:50:58.374 -> [  8919][V][FreeRTOS.cpp:77] wait(): << wait: Semaphore released: name: RegEvt (0x3fcf72ac), owner: <N/A>
08:50:58.374 -> [  8928][V][FreeRTOS.cpp:189] take(): Semaphore taking: name: OpenEvt (0x3fcf7310), owner: <N/A> for connect
08:50:58.374 -> [  8937][V][FreeRTOS.cpp:198] take(): Semaphore taken:  name: OpenEvt (0x3fcf7310), owner: connect
08:50:58.374 -> [  8946][V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: OpenEvt (0x3fcf7310), owner: connect for connect
08:50:58.527 -> [  9100][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_CONNECT_EVT
08:50:58.527 -> [  9100][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_CONNECT_EVT
08:50:58.559 -> [  9107][V][BLEUtils.cpp:1311] dumpGattClientEvent(): [conn_id: 0, remote_bda: cf:28:3f:02:9e:0b]
08:50:58.559 -> [  9116][D][BLEClient.cpp:178] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_CONNECT_EVT
08:50:58.559 -> [  9127][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_OPEN_EVT
08:50:58.591 -> [  9137][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_OPEN_EVT
08:50:58.591 -> [  9145][V][BLEUtils.cpp:1402] dumpGattClientEvent(): [status: ESP_GATT_OK, conn_id: 0, remote_bda: cf:28:3f:02:9e:0b, mtu: 23]
08:50:58.591 -> [  9156][D][BLEClient.cpp:178] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_OPEN_EVT
08:50:58.623 -> [  9166][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: OpenEvt (0x3fcf7310), owner: connect
08:50:58.623 -> [  9175][V][FreeRTOS.cpp:77] wait(): << wait: Semaphore released: name: OpenEvt (0x3fcf7310), owner: <N/A>
08:50:58.623 -> [  9184][V][BLEClient.cpp:149] connect(): << connect(), rc=1
08:50:58.623 ->  - Connected to server

Any help with this would be greatly appreciated. I have some pressure to get these devices connected and working and this bug is far beyond me.

Thank you in advance for any assistance you can provide.

Below is the complete verbose log from start through crash:

08:49:08.812 -> Build:Mar 27 2021
08:49:08.824 -> rst:0x1 (POWERON),boot:0x9 (SPI_FAST_FLASH_BOOT)
08:49:08.824 -> SPIWP:0xee
08:49:08.824 -> mode:DIO, clock div:1
08:49:08.824 -> load:0x3fce3808,len:0x43c
08:49:08.824 -> load:0x403c9700,len:0xbec
08:49:08.824 -> load:0x403cc700,len:0x2a3c
08:49:08.824 -> SHA-256 comparison failed:
08:49:08.824 -> Calculated: dcde8d8a4817d9bf5d5d69a7247667264e4e10ac7493514868b61f5aa6146539
08:49:08.824 -> Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
08:49:08.824 -> Attempting to boot anyway...
08:49:08.842 -> entry 0x403c98d8
08:49:09.002 -> Starting Arduino BLE Client application...
08:49:09.249 -> Starting the scan
08:49:09.249 -> [   464][V][BLEScan.cpp:385] start(): >> start(duration=5)
08:49:09.249 -> [   464][V][FreeRTOS.cpp:189] take(): Semaphore taking: name: ScanEnd (0x3fcf7838), owner: <N/A> for start
08:49:09.249 -> [   469][V][FreeRTOS.cpp:198] take(): Semaphore taken:  name: ScanEnd (0x3fcf7838), owner: start
08:49:09.249 -> [   478][V][BLEScan.cpp:417] start(): << start()
08:49:09.281 -> [   479][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT
08:49:09.281 -> [   482][V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: ScanEnd (0x3fcf7838), owner: start for start
08:49:09.281 -> [   491][V][BLEUtils.cpp:1156] dumpGapEvent(): [status: 0]
08:49:09.281 -> [   507][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_START_COMPLETE_EVT
08:49:09.327 -> [   516][V][BLEUtils.cpp:1221] dumpGapEvent(): [status: 0]
08:49:09.398 -> [   521][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.398 -> [   530][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: cf:28:3f:02:9e:0b, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 20, scan_rsp_len: 20
08:49:09.416 -> [   561][D][BLEAdvertisedDevice.cpp:472] setRSSI(): - setRSSI(): rssi: -77
08:49:09.416 -> [   567][D][BLEAdvertisedDevice.cpp:292] parseAdvertisement(): Type: 0x01 (ESP_BLE_AD_TYPE_FLAG), length: 1, data: 06
08:49:09.416 -> [   578][D][BLEAdvertisedDevice.cpp:292] parseAdvertisement(): Type: 0x02 (ESP_BLE_AD_TYPE_16SRV_PART), length: 4, data: 0d18eefe
08:49:09.416 -> [   589][D][BLEAdvertisedDevice.cpp:500] setServiceUUID(): - addServiceUUID(): serviceUUID: 0000180d-0000-1000-8000-00805f9b34fb
08:49:09.496 -> [   600][D][BLEAdvertisedDevice.cpp:500] setServiceUUID(): - addServiceUUID(): serviceUUID: 0000feee-0000-1000-8000-00805f9b34fb
08:49:09.496 -> [   612][D][BLEAdvertisedDevice.cpp:292] parseAdvertisement(): Type: 0x0a (ESP_BLE_AD_TYPE_TX_PWR), length: 1, data: 04
08:49:09.496 -> [   622][D][BLEAdvertisedDevice.cpp:530] setTXPower(): - txPower: 4
08:49:09.496 -> [   628][D][BLEAdvertisedDevice.cpp:292] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 6, data: 6b003f164c4c
08:49:09.519 -> [   641][D][BLEAdvertisedDevice.cpp:449] setManufacturerData(): - manufacturer data: 6b003f164c4c
08:49:09.520 -> [   649][D][BLEAdvertisedDevice.cpp:292] parseAdvertisement(): Type: 0x09 (ESP_BLE_AD_TYPE_NAME_CMPL), length: 18, data: 506f6c617220483130204243433636463245
08:49:09.520 -> [   663][D][BLEAdvertisedDevice.cpp:461] setName(): - setName(): name: Polar H10 BCC66F2E
08:49:09.520 -> BLE Advertised Device found: Name: Polar H10 BCC66F2E, Address: cf:28:3f:02:9e:0b, manufacturer data: 6b003f164c4c, serviceUUID: 0000180d-0000-1000-8000-00805f9b34fb, serviceUUID: 0000feee-0000-1000-8000-00805f9b34fb, txPower: 4
08:49:09.520 -> [   692][V][BLEScan.cpp:440] stop(): >> stop()
08:49:09.520 -> [   695][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: ScanEnd (0x3fcf7838), owner: start
08:49:09.535 -> [   704][V][BLEScan.cpp:452] stop(): << stop()
08:49:09.535 -> [   704][V][FreeRTOS.cpp:77] wait(): << wait: Semaphore released: name: ScanEnd (0x3fcf7838), owner: <N/A>
08:49:09.547 -> [   708][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.547 -> Scan complete[   726][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: cf:28:3f:02:9e:0b, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 20, scan_rsp_len: 20
08:49:09.547 -> 
08:49:09.547 -> [   758][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.547 -> [   768][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 32:38:4e:1b:1b:21, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -76, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
08:49:09.578 -> [   793][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.578 -> [   802][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: cf:28:3f:02:9e:0b, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 20, scan_rsp_len: 20
08:49:09.611 -> [   833][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.643 -> [   841][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: cf:28:3f:02:9e:0b, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -76, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 20, scan_rsp_len: 20
08:49:09.675 -> [   872][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.675 -> [   881][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 32:38:4e:1b:1b:21, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -74, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
08:49:09.707 -> [   908][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.707 -> [   916][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 58:41:19:ff:49:b8, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -87, ble_adv: ??, flag: 26 ([LE General Discoverable Mode] [Simultaneous LE and BR/EDR to Same Device Capable (Controller)] [Simultaneous LE and BR/EDR to Same Device Capable (Host)] ), num_resps: 1, adv_data_len: 19, scan_rsp_len: 0
08:49:09.739 -> [   957][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.739 -> [   964][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: cf:28:3f:02:9e:0b, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -76, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 20, scan_rsp_len: 20
08:49:09.771 -> [   996][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.803 -> [  1004][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: cf:28:3f:02:9e:0b, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 20, scan_rsp_len: 20
08:49:09.835 -> [  1035][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.835 -> [  1044][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 32:38:4e:1b:1b:21, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -74, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
08:49:09.867 -> [  1070][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.867 -> [  1079][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: cf:28:3f:02:9e:0b, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 20, scan_rsp_len: 20
08:49:09.899 -> [  1110][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.899 -> [  1118][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: cf:28:3f:02:9e:0b, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 20, scan_rsp_len: 20
08:49:09.931 -> [  1149][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.931 -> [  1158][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: cf:28:3f:02:9e:0b, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -78, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 20, scan_rsp_len: 20
08:49:09.963 -> [  1189][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:09.995 -> [  1197][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 32:38:4e:1b:1b:21, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -74, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
08:49:10.027 -> [  1224][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:10.027 -> [  1233][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: cf:28:3f:02:9e:0b, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 20, scan_rsp_len: 20
08:49:10.059 -> [  1264][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
08:49:10.059 -> [  1272][V][BLEUtils.cpp:1189] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: cf:28:3f:02:9e:0b, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 20, scan_rsp_len: 20
08:49:10.094 -> [  1303][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT
08:49:10.094 -> [  1312][V][BLEUtils.cpp:1230] dumpGapEvent(): [status: 0]
08:49:10.556 -> Forming a connection to cf:28:3f:02:9e:0b
08:49:10.556 -> [  1769][V][BLEDevice.cpp:60] createClient(): >> createClient
08:49:10.556 -> [  1769][V][BLEDevice.cpp:66] createClient(): << createClient
08:49:10.556 ->  - Created client
08:49:10.556 -> Connecting to server
08:49:10.556 -> [  1782][V][BLEClient.cpp:98] connect(): >> connect(cf:28:3f:02:9e:0b)
08:49:10.556 -> [  1782][I][BLEDevice.cpp:622] addPeerDevice(): add conn_id: 0, GATT role: client
08:49:10.588 -> [  1789][V][FreeRTOS.cpp:189] take(): Semaphore taking: name: RegEvt (0x3fcf789c), owner: <N/A> for connect
08:49:10.588 -> [  1798][V][FreeRTOS.cpp:198] take(): Semaphore taken:  name: RegEvt (0x3fcf789c), owner: connect
08:49:10.588 -> [  1807][V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: RegEvt (0x3fcf789c), owner: connect for connect
08:49:10.620 -> [  1807][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_REG_EVT
08:49:10.620 -> [  1828][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_REG_EVT
08:49:10.620 -> [  1835][V][BLEUtils.cpp:1444] dumpGattClientEvent(): [status: ESP_GATT_OK, app_id: 0x0]
08:49:10.620 -> [  1843][D][BLEClient.cpp:178] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_REG_EVT
08:49:10.652 -> [  1853][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: RegEvt (0x3fcf789c), owner: connect
08:49:10.652 -> [  1862][V][FreeRTOS.cpp:77] wait(): << wait: Semaphore released: name: RegEvt (0x3fcf789c), owner: <N/A>
08:49:10.652 -> [  1871][V][FreeRTOS.cpp:189] take(): Semaphore taking: name: OpenEvt (0x3fcf724c), owner: <N/A> for connect
08:49:10.652 -> [  1881][V][FreeRTOS.cpp:198] take(): Semaphore taken:  name: OpenEvt (0x3fcf724c), owner: connect
08:49:10.696 -> [  1890][V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: OpenEvt (0x3fcf724c), owner: connect for connect
08:49:10.795 -> [  2020][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_CONNECT_EVT
08:49:10.795 -> [  2021][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_CONNECT_EVT
08:49:10.827 -> [  2028][V][BLEUtils.cpp:1311] dumpGattClientEvent(): [conn_id: 0, remote_bda: cf:28:3f:02:9e:0b]
08:49:10.827 -> [  2036][D][BLEClient.cpp:178] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_CONNECT_EVT
08:49:10.827 -> [  2047][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_OPEN_EVT
08:49:10.859 -> [  2058][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_OPEN_EVT
08:49:10.859 -> [  2065][V][BLEUtils.cpp:1402] dumpGattClientEvent(): [status: ESP_GATT_OK, conn_id: 0, remote_bda: cf:28:3f:02:9e:0b, mtu: 23]
08:49:10.859 -> [  2076][D][BLEClient.cpp:178] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_OPEN_EVT
08:49:10.859 -> [  2087][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: OpenEvt (0x3fcf724c), owner: connect
08:49:10.892 -> [  2095][V][FreeRTOS.cpp:77] wait(): << wait: Semaphore released: name: OpenEvt (0x3fcf724c), owner: <N/A>
08:49:10.892 -> [  2105][V][BLEClient.cpp:149] connect(): << connect(), rc=1
08:49:10.892 ->  - Connected to server
08:49:10.892 -> Getting services? [0000180d-0000-1000-8000-00805f9b34fb]
08:49:10.892 -> ID of advertised service? [0000180d-0000-1000-8000-00805f9b34fb]
08:49:10.923 -> Ask for services
08:49:10.923 -> [  2131][V][BLEClient.cpp:448] getServices(): >> getServices
08:49:10.923 -> [  2131][V][BLEClient.cpp:73] clearServices(): >> clearServices
08:49:10.923 -> [  2135][V][BLEClient.cpp:80] clearServices(): << clearServices
08:49:10.923 -> [  2141][V][FreeRTOS.cpp:189] take(): Semaphore taking: name: SearchCmplEvt (0x3fcf72b0), owner: <N/A> for getServices
08:49:10.923 -> [  2151][V][FreeRTOS.cpp:198] take(): Semaphore taken:  name: SearchCmplEvt (0x3fcf72b0), owner: getServices
08:49:10.965 -> [  2161][V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: SearchCmplEvt (0x3fcf72b0), owner: getServices for getServices
08:49:12.204 -> Guru Meditation Error: Core  0 panic'ed (Unhandled debug exception). 
08:49:12.236 -> Debug exception reason: Stack canary watchpoint triggered (BTU_TASK) 
08:49:12.236 -> Core  0 register dump:
08:49:12.236 -> PC      : 0x4037f9af  PS      : 0x00060f36  A0      : 0x803820c0  A1      : 0x3fcf54f0  
08:49:12.236 -> A2      : 0x3fc9dc0c  A3      : 0xb33fffff  A4      : 0x0000abab  A5      : 0x00060f23  
08:49:12.236 -> A6      : 0x00060f23  A7      : 0x0000cdcd  A8      : 0x0000cdcd  A9      : 0xffffffff  
08:49:12.268 -> A10     : 0x00000000  A11     : 0x00000000  A12     : 0x00000008  A13     : 0x00000008  
08:49:12.268 -> A14     : 0x02c9dc0c  A15     : 0x00ffffff  SAR     : 0x00000020  EXCCAUSE: 0x00000001  
08:49:12.268 -> EXCVADDR: 0x00000000  LBEG    : 0x400570e8  LEND    : 0x400570f3  LCOUNT  : 0xffffffff  
08:49:12.268 -> 
08:49:12.268 -> 
08:49:12.268 -> Backtrace:0x4037f9ac:0x3fcf54f00x403820bd:0x3fcf5530 0x403820ea:0x3fcf5550 0x40382330:0x3fcf5570 0x40377275:0x3fcf5590 0x40377289:0x3fcf55c0 0x403772b9:0x3fcf55e0 0x4038276a:0x3fcf5600 0x40382788:0x3fcf5620 0x42040101:0x3fcf5640 0x4203f8cd:0x3fcf5660 0x420406d9:0x3fcf5680 0x4201f7f9:0x3fcf56a0 0x4201fa75:0x3fcf56c0 0x420205e5:0x3fcf56e0 0x42039895:0x3fcf5700 0x4203a0d6:0x3fcf5720 0x420383c1:0x3fcf5740 0x4204b2cf:0x3fcf5760 0x4204b463:0x3fcf5780 0x4204b592:0x3fcf57a0 0x420300c7:0x3fcf57e0 0x4202f2d9:0x3fcf5a70 0x420446cd:0x3fcf5aa0 0x42044740:0x3fcf5ae0 0x42044b19:0x3fcf5b00 0x42044bad:0x3fcf5d90 0x42044bcb:0x3fcf5db0 0x42044b9b:0x3fcf5dd0 0x42044bcb:0x3fcf5df0 0x42044b9b:0x3fcf5e10 0x42044bcb:0x3fcf5e30 0x42044b9b:0x3fcf5e50 0x42044bcb:0x3fcf5e70 0x42044b9b:0x3fcf5e90 0x42044bcb:0x3fcf5eb0 0x42044b9b:0x3fcf5ed0 0x42044c22:0x3fcf5ef0 0x420355f1:0x3fcf5f10 0x420300fe:0x3fcf61c0 0x420305be:0x3fcf6450 0x420310e9:0x3fcf64b0 0x42032950:0x3fcf6500 0x420329f9:0x3fcf6520 0x4203a709:0x3fcf6540 0x4202dd94:0x3fcf6580 0x42040493:0x3fcf65a0 
08:49:12.368 -> 
08:49:12.368 -> 
08:49:12.368 -> 
08:49:12.368 -> 
08:49:12.368 -> ELF file SHA256: 0000000000000000
08:49:12.368 -> 
08:49:12.368 -> Rebooting...
leegs commented 4 months ago

I switched to the espressif/arduino-esp library and it works. Setting the board to "Heltec WiFi LoRa 32(V3) / Wireless shell(V3) / Wireless stick lite (V3)" will allow to build and download.

While the BLE is working perfectly, none of the libraries for either LoRa or the OLED will work with the different board using the espressif/arduino-esp library. I need to get the LoRa radio working. That appears to be fine in the Heltec library.

I believe the quickest solution would be to update the BLE library in Heltec library to the newest from espressif/arduino-esp. (Might as well do the whole system.) I know I would certainly appreciate it.

Thanks.