Using BluFi demo with Arduino

Kampino
Posts: 7
Joined: Fri Jan 08, 2021 12:19 pm

Using BluFi demo with Arduino

Postby Kampino » Fri Jan 08, 2021 12:28 pm

Hello,

I want to use the BluFi demo in combination with the Arduino framework, so I modify the code:

Code: Select all

#include "blufi_demo.h"

static uint8_t UUID[32] = {
    /* LSB <--------------------------------------------------------------------------------> MSB */
    //first uuid, 16bit, [12],[13] is the value
    0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00,
};

static esp_ble_adv_data_t AdvertisingData = {
    .set_scan_rsp           = false,
    .include_name           = true,
    .include_txpower        = true,
    .min_interval           = 0x0006, //slave connection min interval, Time = min_interval * 1.25 msec
    .max_interval           = 0x0010, //slave connection max interval, Time = max_interval * 1.25 msec
    .appearance             = 0x00,
    .manufacturer_len       = 0,
    .p_manufacturer_data    = NULL,
    .service_data_len       = 0,
    .p_service_data         = NULL,
    .service_uuid_len       = 16,
    .p_service_uuid         = UUID,
    .flag                   = 0x6,
};

static esp_ble_adv_params_t AdvertisingParams;

static wifi_config_t sta_config;
static wifi_config_t ap_config;

/* FreeRTOS event group to signal when we are connected & ready to make a request */
static EventGroupHandle_t wifi_event_group;

/* The event group allows multiple bits for each event,
   but we only care about one event - are we connected
   to the AP with an IP? */
const int CONNECTED_BIT = BIT0;

/* store the station info for send back to phone */
static bool gl_sta_connected = false;
static bool BLE_IsConnected = false;
static uint8_t gl_sta_bssid[6];
static uint8_t gl_sta_ssid[32];
static int gl_sta_ssid_len;

static uint8_t BluFi_ServerInterface;
static uint16_t BluFi_ConnectionID;

static esp_err_t Application_EventCallback(void* p_Context, system_event_t* p_Event)
{
    switch(p_Event->event_id)
    {
        case SYSTEM_EVENT_STA_START:
        {
            esp_wifi_connect();

            break;
        }
        case SYSTEM_EVENT_STA_GOT_IP:
        {
            wifi_mode_t Mode;
            esp_blufi_extra_info_t Info;

            xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
            esp_wifi_get_mode(&Mode);

            memset(&Info, 0, sizeof(esp_blufi_extra_info_t));
            memcpy(Info.sta_bssid, gl_sta_bssid, 6);
            Info.sta_bssid_set = true;
            Info.sta_ssid = gl_sta_ssid;
            Info.sta_ssid_len = gl_sta_ssid_len;

            if(BLE_IsConnected == true)
            {
                esp_blufi_send_wifi_conn_report(Mode, ESP_BLUFI_STA_CONN_SUCCESS, 0x00, &Info);
            }
            else
            {
                BLUFI_INFO("[DEBUG] BluFi BLE is not connected!\n");
            }

            break;
        }
        case SYSTEM_EVENT_STA_CONNECTED:
        {
            gl_sta_connected = true;
            memcpy(gl_sta_bssid, p_Event->event_info.connected.bssid, 6);
            memcpy(gl_sta_ssid, p_Event->event_info.connected.ssid, p_Event->event_info.connected.ssid_len);
            gl_sta_ssid_len = p_Event->event_info.connected.ssid_len;

            break;
        }
        case SYSTEM_EVENT_STA_DISCONNECTED:
        {
            // This is a workaround as ESP32 WiFi libs don't currently auto-reassociate.
            gl_sta_connected = false;
            memset(gl_sta_ssid, 0, 32);
            memset(gl_sta_bssid, 0, 6);
            gl_sta_ssid_len = 0;
            esp_wifi_connect();
            xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);

            break;
        }
        case SYSTEM_EVENT_AP_START:
        {
            wifi_mode_t Mode;

            esp_wifi_get_mode(&Mode);

            if(BLE_IsConnected == true)
            {
                if(gl_sta_connected)
                {
                    esp_blufi_send_wifi_conn_report(Mode, ESP_BLUFI_STA_CONN_SUCCESS, 0x00, NULL);
                }
                else
                {
                    esp_blufi_send_wifi_conn_report(Mode, ESP_BLUFI_STA_CONN_FAIL, 0x00, NULL);
                }
            } 
            else
            {
                BLUFI_INFO("[DEBUG] BluFi BLE is not connected!\n");
            }
            break;
        }
        case SYSTEM_EVENT_SCAN_DONE:
        {
            uint16_t apCount = 0x00;

            esp_wifi_scan_get_ap_num(&apCount);

            if(apCount == 0)
            {
                BLUFI_INFO("[DEBUG] No AP found!\n");

                break;
            }

            wifi_ap_record_t* ap_list = (wifi_ap_record_t*)malloc(sizeof(wifi_ap_record_t) * apCount);
            if(!ap_list)
            {
                BLUFI_ERROR("[DEBUG] Malloc error, ap_list is NULL!\n");

                break;
            }

            ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&apCount, ap_list));
            esp_blufi_ap_record_t* blufi_ap_list = (esp_blufi_ap_record_t*)malloc(apCount * sizeof(esp_blufi_ap_record_t));
    
            if(!blufi_ap_list)
            {
                if(ap_list)
                {
                    free(ap_list);
                }

                BLUFI_ERROR("[DEBUG] Malloc error, blufi_ap_list is NULL!\n");

                break;
            }

            for(uint16_t i = 0x00; i < apCount; ++i)
            {
                blufi_ap_list[i].rssi = ap_list[i].rssi;
                memcpy(blufi_ap_list[i].ssid, ap_list[i].ssid, sizeof(ap_list[i].ssid));
            }

            if(BLE_IsConnected == true)
            {
                esp_blufi_send_wifi_list(apCount, blufi_ap_list);
            }
            else
            {
                BLUFI_INFO("[DEBUG] BluFi BLE is not connected!\n");
            }

            esp_wifi_scan_stop();
            free(ap_list);
            free(blufi_ap_list);

            break;
        }
        default:
        {
            break;
        }
    }
    return ESP_OK;
}

static void EventCallback(esp_blufi_cb_event_t Event, esp_blufi_cb_param_t* p_Param)
{
    switch(Event)
    {
        case ESP_BLUFI_EVENT_INIT_FINISH:
        {
            esp_ble_gap_set_device_name(BLUFI_DEVICE_NAME);
            esp_ble_gap_config_adv_data(&AdvertisingData);

            BLUFI_INFO("[DEBUG] BluFi init finished!\n");

            break;
        }
        case ESP_BLUFI_EVENT_DEINIT_FINISH:
        {
            BLUFI_INFO("[DEBUG] BluFi deinit finished!\n");

            break;
        }
        case ESP_BLUFI_EVENT_BLE_CONNECT:
        {
            BLE_IsConnected = true;
            BluFi_ServerInterface = p_Param->connect.server_if;
            BluFi_ConnectionID = p_Param->connect.conn_id;
            esp_ble_gap_stop_advertising();
            BluFi_Init();

            BLUFI_INFO("[DEBUG] BluFi BLE connected!\n");

            break;
        }
        case ESP_BLUFI_EVENT_BLE_DISCONNECT:
        {
            BLE_IsConnected = false;
            BluFi_Deinit();
            esp_ble_gap_start_advertising(&AdvertisingParams);

            BLUFI_INFO("[DEBUG] BluFi BLE disconnected!\n");

            break;
        }
        case ESP_BLUFI_EVENT_SET_WIFI_OPMODE:
        {
            ESP_ERROR_CHECK(esp_wifi_set_mode(p_Param->wifi_mode.op_mode));

            BLUFI_INFO("[Debug] BluFi set WiFi opmode %d!\n", p_Param->wifi_mode.op_mode);

            break;
        }
        case ESP_BLUFI_EVENT_REQ_CONNECT_TO_AP:
        {
            esp_wifi_disconnect();
            esp_wifi_connect();

            BLUFI_INFO("[DEBUG] BluFi request WiFi connect to AP!\n");

            break;
        }
        case ESP_BLUFI_EVENT_REQ_DISCONNECT_FROM_AP:
        {
            esp_wifi_disconnect();

            BLUFI_INFO("[DEBUG] BluFi request WiFi disconnect from AP!\n");

            break;
        }
        case ESP_BLUFI_EVENT_REPORT_ERROR:
        {
            esp_blufi_send_error_info(p_Param->report_error.state);

            BLUFI_ERROR("[DEBUG] BluFi report error, error code %d!\n", p_Param->report_error.state);

            break;
        }
        case ESP_BLUFI_EVENT_GET_WIFI_STATUS:
        {
            wifi_mode_t Mode;
            esp_blufi_extra_info_t Info;

            esp_wifi_get_mode(&Mode);

            if(gl_sta_connected)
            {
                memset(&Info, 0x00, sizeof(esp_blufi_extra_info_t));
                memcpy(Info.sta_bssid, gl_sta_bssid, 6);
                Info.sta_bssid_set = true;
                Info.sta_ssid = gl_sta_ssid;
                Info.sta_ssid_len = gl_sta_ssid_len;
                esp_blufi_send_wifi_conn_report(Mode, ESP_BLUFI_STA_CONN_SUCCESS, 0x00, &Info);
            }
            else
            {
                esp_blufi_send_wifi_conn_report(Mode, ESP_BLUFI_STA_CONN_FAIL, 0x00, NULL);
            }

            BLUFI_INFO("[DEBUG] BluFi get WiFi status from AP!\n");

            break;
        }
        case ESP_BLUFI_EVENT_RECV_SLAVE_DISCONNECT_BLE:
        {
            esp_blufi_close(BluFi_ServerInterface, BluFi_ConnectionID);

            BLUFI_INFO("DEBUG] BluFi close a GATT connection!\n");

            break;
        }
        case ESP_BLUFI_EVENT_DEAUTHENTICATE_STA:
        {
            break;
        }
        case ESP_BLUFI_EVENT_RECV_STA_BSSID:
        {
            memcpy(sta_config.sta.bssid, p_Param->sta_bssid.bssid, 6);
            sta_config.sta.bssid_set = 1;
            esp_wifi_set_config(WIFI_IF_STA, &sta_config);

            BLUFI_INFO("[DEBUG] Recv STA BSSID %s!\n", sta_config.sta.ssid);

            break;
        }
        case ESP_BLUFI_EVENT_RECV_STA_SSID:
        {
            strncpy((char *)sta_config.sta.ssid, (char *)p_Param->sta_ssid.ssid, p_Param->sta_ssid.ssid_len);
            sta_config.sta.ssid[p_Param->sta_ssid.ssid_len] = '\0';
            esp_wifi_set_config(WIFI_IF_STA, &sta_config);

            BLUFI_INFO("[DEBUG] Recv STA SSID %s!\n", sta_config.sta.ssid);

            break;
        }
        case ESP_BLUFI_EVENT_RECV_STA_PASSWD:
        {
            strncpy((char *)sta_config.sta.password, (char *)p_Param->sta_passwd.passwd, p_Param->sta_passwd.passwd_len);
            sta_config.sta.password[p_Param->sta_passwd.passwd_len] = '\0';
            esp_wifi_set_config(WIFI_IF_STA, &sta_config);

            BLUFI_INFO("[DEBUG] Recv STA PASSWORD %s!\n", sta_config.sta.password);

            break;
        }
        case ESP_BLUFI_EVENT_RECV_SOFTAP_SSID:
        {
            strncpy((char*)ap_config.ap.ssid, (char*)p_Param->softap_ssid.ssid, p_Param->softap_ssid.ssid_len);
            ap_config.ap.ssid[p_Param->softap_ssid.ssid_len] = '\0';
            ap_config.ap.ssid_len = p_Param->softap_ssid.ssid_len;
            esp_wifi_set_config(WIFI_IF_AP, &ap_config);

            BLUFI_INFO("[DEBUG] Recv SOFTAP SSID %s, ssid len %d!\n", ap_config.ap.ssid, ap_config.ap.ssid_len);

            break;
        }
        case ESP_BLUFI_EVENT_RECV_SOFTAP_PASSWD:
        {
            strncpy((char *)ap_config.ap.password, (char *)p_Param->softap_passwd.passwd, p_Param->softap_passwd.passwd_len);
            ap_config.ap.password[p_Param->softap_passwd.passwd_len] = '\0';
            esp_wifi_set_config(WIFI_IF_AP, &ap_config);

            BLUFI_INFO("[DEBUG] Recv SOFTAP PASSWORD %s len = %d!\n", ap_config.ap.password, p_Param->softap_passwd.passwd_len);

            break;
        }
        case ESP_BLUFI_EVENT_RECV_SOFTAP_MAX_CONN_NUM:
        {
            if(p_Param->softap_max_conn_num.max_conn_num > 4)
            {
                return;
            }

            ap_config.ap.max_connection = p_Param->softap_max_conn_num.max_conn_num;
            esp_wifi_set_config(WIFI_IF_AP, &ap_config);

            BLUFI_INFO("[DEBUG] Recv SOFTAP MAX CONN NUM %d!\n", ap_config.ap.max_connection);
    
            break;
        }
        case ESP_BLUFI_EVENT_RECV_SOFTAP_AUTH_MODE:
        {
            if(p_Param->softap_auth_mode.auth_mode >= WIFI_AUTH_MAX)
            {
                return;
            }

            ap_config.ap.authmode = p_Param->softap_auth_mode.auth_mode;
            esp_wifi_set_config(WIFI_IF_AP, &ap_config);

            BLUFI_INFO("[DEBUG]Recv SOFTAP AUTH MODE %d!\n", ap_config.ap.authmode);

            break;
        }
        case ESP_BLUFI_EVENT_RECV_SOFTAP_CHANNEL:
        {
            if(p_Param->softap_channel.channel > 13)
            {
                return;
            }

            ap_config.ap.channel = p_Param->softap_channel.channel;
            esp_wifi_set_config(WIFI_IF_AP, &ap_config);

            BLUFI_INFO("[DEBUG] Recv SOFTAP CHANNEL %d!\n", ap_config.ap.channel);

            break;
        }
        case ESP_BLUFI_EVENT_GET_WIFI_LIST:
        {
            wifi_scan_config_t ScanConfig = {
                .ssid = NULL,
                .bssid = NULL,
                .channel = 0,
                .show_hidden = false
            };

            ESP_ERROR_CHECK(esp_wifi_scan_start(&ScanConfig, true));

            break;
        }
        case ESP_BLUFI_EVENT_RECV_CUSTOM_DATA:
        {
            BLUFI_INFO("Recv Custom Data %d\n", p_Param->custom_data.data_len);
            esp_log_buffer_hex("Custom Data", p_Param->custom_data.data, p_Param->custom_data.data_len);

            break;
        }
	    case ESP_BLUFI_EVENT_RECV_USERNAME:
        {
            break;
        }
	    case ESP_BLUFI_EVENT_RECV_CA_CERT:
        {
            break;
        }
	    case ESP_BLUFI_EVENT_RECV_CLIENT_CERT:
        {
            break;
        }
	    case ESP_BLUFI_EVENT_RECV_SERVER_CERT:
        {
            break;
        }
	    case ESP_BLUFI_EVENT_RECV_CLIENT_PRIV_KEY:
        {
            break;
        }
	    case ESP_BLUFI_EVENT_RECV_SERVER_PRIV_KEY:
        {
            break;
        }
        default:
        {
            break;
        }
    }
}

static void GAP_EventHandler(esp_gap_ble_cb_event_t Event, esp_ble_gap_cb_param_t* p_Param)
{
    switch(Event)
    {
        case ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT:
        {
            AdvertisingParams.adv_int_min            = 0x100;
            AdvertisingParams.adv_int_max            = 0x100;
            AdvertisingParams.adv_type               = ADV_TYPE_IND;
            AdvertisingParams.own_addr_type          = BLE_ADDR_TYPE_PUBLIC;
            AdvertisingParams.channel_map            = ADV_CHNL_ALL;
            AdvertisingParams.adv_filter_policy      = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY;

            esp_ble_gap_start_advertising(&AdvertisingParams);

            break;
        }
        default:
        {
            break;
        }
    }
}

static esp_blufi_callbacks_t Callbacks = {
    .event_cb = EventCallback,
    .negotiate_data_handler = BluFi_DH_DataHandler,
    .encrypt_func = BluFi_Encrypt,
    .decrypt_func = BluFi_Decrypt,
    .checksum_func = BluFi_CRC,
};

void app_main()
{

}

void setup(void)
{
    esp_err_t ret;
    esp_bt_controller_config_t BT_Config = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
    wifi_init_config_t WiFi_Config = WIFI_INIT_CONFIG_DEFAULT();

    ret = nvs_flash_init();
    if((ret == ESP_ERR_NVS_NO_FREE_PAGES) || (ret == ESP_ERR_NVS_NEW_VERSION_FOUND))
    {
        ESP_ERROR_CHECK(nvs_flash_erase());
        ret = nvs_flash_init();
    }
    ESP_ERROR_CHECK(ret);

    tcpip_adapter_init();
    wifi_event_group = xEventGroupCreate();

    // Initialize the event loop
    ESP_ERROR_CHECK(esp_event_loop_init(Application_EventCallback, NULL));

    // Initialize the WiFi
    ESP_ERROR_CHECK(esp_wifi_init(&WiFi_Config));
    ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
    ESP_ERROR_CHECK(esp_wifi_start());

    ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT));

    ret = esp_bt_controller_init(&BT_Config);
    if(ret)
    {
        BLUFI_ERROR("[DEBUG] %s initialize bt controller failed: %s\n", __func__, esp_err_to_name(ret));
    }

    ret = esp_bt_controller_enable(ESP_BT_MODE_BLE);
    if(ret)
    {
        BLUFI_ERROR("[DEBUG] %s enable bt controller failed: %s!\n", __func__, esp_err_to_name(ret));
        return;
    }

    ret = esp_bluedroid_init();
    if(ret)
    {
        BLUFI_ERROR("[DEBUG] %s init bluedroid failed: %s!\n", __func__, esp_err_to_name(ret));
        return;
    }

    ret = esp_bluedroid_enable();
    if(ret)
    {
        BLUFI_ERROR("[DEBUG] %s init bluedroid failed: %s!\n", __func__, esp_err_to_name(ret));
        return;
    }

    BLUFI_INFO("BD ADDR: "ESP_BD_ADDR_STR"\n", ESP_BD_ADDR_HEX(esp_bt_dev_get_address()));
    BLUFI_INFO("BLUFI VERSION %04x\n", esp_blufi_get_version());

    ret = esp_ble_gap_register_callback(GAP_EventHandler);
    if(ret)
    {
        BLUFI_ERROR("[DEBUG] %s gap register failed, error code = %x!\n", __func__, ret);
        return;
    }

    ret = esp_blufi_register_callbacks(&Callbacks);
    if(ret)
    {
        BLUFI_ERROR("[DEBUG] %s BluFi register failed, error code = %x!\n", __func__, ret);
        return;
    }

    esp_blufi_profile_init();
}

void loop(void)
{

}
The code compiled successful, but the ESP prints this message:

Code: Select all

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6284
load:0x40078000,len:10112
load:0x40080400,len:6492
entry 0x40080750
␛[0;32mI (29) boot: ESP-IDF 3.30300.190916 2nd stage bootloader␛[0m
␛[0;32mI (29) boot: compile time 11:58:07␛[0m
␛[0;32mI (29) boot: Enabling RNG early entropy source...␛[0m
␛[0;32mI (34) boot: SPI Speed      : 40MHz␛[0m
␛[0;32mI (38) boot: SPI Mode       : DIO␛[0m
␛[0;32mI (42) boot: SPI Flash Size : 4MB␛[0m
␛[0;32mI (46) boot: Partition Table:␛[0m
␛[0;32mI (50) boot: ## Label            Usage          Type ST Offset   Length␛[0m
␛[0;32mI (57) boot:  0 nvs              WiFi data        01 02 00009000 00006000␛[0m
␛[0;32mI (65) boot:  1 phy_init         RF data          01 01 0000f000 00001000␛[0m
␛[0;32mI (72) boot:  2 factory          factory app      00 00 00010000 00100000␛[0m
␛[0;32mI (80) boot: End of partition table␛[0m
␛[0;32mI (84) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x2a960 (174432) map␛[0m
␛[0;32mI (152) esp_image: segment 1: paddr=0x0003a988 vaddr=0x3ffbdb60 size=0x03584 ( 13700) load␛[0m
␛[0;32mI (157) esp_image: segment 2: paddr=0x0003df14 vaddr=0x40080000 size=0x00400 (  1024) load␛[0m
␛[0;32mI (159) esp_image: segment 3: paddr=0x0003e31c vaddr=0x40080400 size=0x01cf4 (  7412) load␛[0m
␛[0;32mI (170) esp_image: segment 4: paddr=0x00040018 vaddr=0x400d0018 size=0xaecac (715948) map␛[0m
␛[0;32mI (418) esp_image: segment 5: paddr=0x000eeccc vaddr=0x400820f4 size=0x132cc ( 78540) load␛[0m
␛[0;32mI (461) boot: Loaded app from partition at offset 0x10000␛[0m
␛[0;32mI (461) boot: Disabling RNG early entropy source...␛[0m
␛[0;32mI (462) cpu_start: Pro cpu up.␛[0m
␛[0;32mI (465) cpu_start: Application information:␛[0m
␛[0;32mI (470) cpu_start: Project name:     BluFiDemo␛[0m
␛[0;32mI (475) cpu_start: App version:      1.0.0␛[0m
␛[0;32mI (480) cpu_start: Compile time:     Jan  8 2021 11:58:11␛[0m
␛[0;32mI (486) cpu_start: ELF file SHA256:  0000000000000000...␛[0m
␛[0;32mI (492) cpu_start: ESP-IDF:          3.30300.190916␛[0m
␛[0;32mI (498) cpu_start: Starting app cpu, entry point is 0x400813b0␛[0m
␛[0;32mI (490) cpu_start: App cpu up.␛[0m
␛[0;32mI (508) heap_init: Initializing. RAM available for dynamic allocation:␛[0m
␛[0;32mI (515) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM␛[0m
␛[0;32mI (521) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM␛[0m
␛[0;32mI (527) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM␛[0m
␛[0;32mI (533) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM␛[0m
␛[0;32mI (539) heap_init: At 3FFCE3F8 len 00011C08 (71 KiB): DRAM␛[0m
␛[0;32mI (546) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM␛[0m
␛[0;32mI (552) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM␛[0m
␛[0;32mI (558) heap_init: At 400953C0 len 0000AC40 (43 KiB): IRAM␛[0m
␛[0;32mI (564) cpu_start: Pro cpu start user code␛[0m
␛[0;32mI (247) cpu_start: Chip Revision: 1␛[0m
␛[0;33mW (248) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it.␛[0=fHh�␅ښ�j%�(251) cpu_start: Starting scheduler on PRO CPU.␛[0m
␛[0;32mI (0) cpu_start: Starting scheduler on APP CPU.␛[0m
I (50) wifi: wifi driver task: 3ffb97c4, prio:23, stack:3584, core=0
␛[0;32mI (272) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE␛[0m
␛[0;32mI (272) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE␛[0m
I (302) wifi: wifi firmware version: aeed694
I (302) wifi: config NVS flash: enabled
I (302) wifi: config nano formating: disabled
I (302) wifi: Init dynamic tx buffer num: 32
I (302) wifi: Init data frame dynamic rx buffer num: 32
I (312) wifi: Init management frame dynamic rx buffer num: 32
I (312) wifi: Init management short buffer num: 32
I (322) wifi: Init static rx buffer size: 1600
I (322) wifi: Init static rx buffer num: 10
I (332) wifi: Init dynamic rx buffer num: 32
␛[0;32mI (422) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0␛[0m
I (422) wifi: mode : sta (24:62:ab:f2:e3:88)
ESP_ERROR_CHECK failed: esp_err_t 0x103 (ESP_ERR_INVALID_STATE) at 0x4008c1b8
file: "src\main.cpp" line 509
func: void setup()
expression: esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT)

ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000

Backtrace: 0x4008bc2b:0x3ffb1e50 0x4008c1bb:0x3ffb1e70 0x400d38e6:0x3ffb1e90 0x401779de:0x3ffb1fa0 0x40090fd1:0x3ffb1fc0

Rebooting...
So it seems that the ESP enters an invalid state. How can I fix it?

Who is online

Users browsing this forum: Baidu [Spider] and 37 guests