Basing my code on Neil Kolbans c example here: https://github.com/nkolban/esp32-snippe ... ner/ble1.c
I know he wrote C++ wrappers that are also included in the 1.0.4 ESP code for Arduino but I have different issues w that code and my Govee thermometer BLE devices, so I want to create the simplest possible BLE scanner code.
The code below fails in the esp_bt_controller_init call. Why ?
Code: Select all
void setup()
{
Serial.begin(115200);
esp_err_t status;
// Initialize NVS flash storage with layout given in the partition table
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES)
{
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK( ret );
// Initialize BT controller to allocate task and other resource.
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
if (esp_bt_controller_init(&bt_cfg) != ESP_OK)
{
ESP_LOGE(tag, "Bluetooth controller initialize failed");
return;
}
...
More details from the compiler:
Code: Select all
Sketch uses 862543 bytes (43%) of program storage space. Maximum is 1966080 bytes.
Global variables use 35432 bytes (10%) of dynamic memory, leaving 292248 bytes for local variables. Maximum is 327680 bytes.
esptool.py v2.6
Serial port /dev/cu.SLAB_USBtoUART
Connecting........____
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: 3c:71:bf:6e:95:70
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 8192 bytes to 47...
Board: Adafruit ESP32 Feather https://www.adafruit.com/product/3405
Partition Scheme: Minimal SPIFFS (large APPS with OTA)
Espressiv ESP32 v1.0.4 installed
So it doesn't look like this is due to any memory issues ...