1. Those are logs from monitor, the error is in wifi initialization function. But during debuging, the error appeard on earlier stage of program, so I guess it isn't the cause
Main function wifi initialization is befor starting my tasks.
Code: Select all
void app_main()
{
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
MDF_LOGI("This is %s chip with %d CPU core(s), WiFi%s%s, ",
CONFIG_IDF_TARGET,
chip_info.cores,
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
MDF_LOGI("silicon revision %d, ", chip_info.revision);
initialisation();
mwifi_init_config_t cfg = MWIFI_INIT_CONFIG_DEFAULT();
MDF_LOGI("Lantern enabled");
mwifi_config_t config;
MDF_LOGI("INITIALIZED CHANNEL NUMBER: %d", config.channel);
uint8_t channel = 0;
config.channel = channel;
size_t required_size;
esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
err = nvs_flash_init();
}
ESP_ERROR_CHECK( err );
nvs_handle_t handle;
err = nvs_open("storage", NVS_READWRITE, &handle);
if (err != ESP_OK)
{
MDF_LOGE("Error (%s) opening NVS handle! ESP will restart in 5 seconds", esp_err_to_name(err));
vTaskDelay(pdMS_TO_TICKS(5000));
esp_restart();
}
else
{
MDF_LOGI("NVS initialised");
err = nvs_get_u8(handle, "edge_configured", &edge_configured);
switch (err)
{
case ESP_OK:
MDF_LOGI("edge_configured = %d", edge_configured);
break;
case ESP_ERR_NVS_NOT_FOUND:
MDF_LOGW("edge_configured is not initialized yet!");
break;
default :
MDF_LOGE("Error (%s) reading edge_configured!", esp_err_to_name(err));
}
if ( edge_configured )
{
nvs_get_str(handle, "edge_ip", NULL, &required_size);
edge_ip = (char*) malloc(required_size);
err = nvs_get_str(handle, "edge_ip", edge_ip, &required_size);
switch (err)
{
case ESP_OK:
MDF_LOGI("edge_ip = %s", edge_ip);
break;
case ESP_ERR_NVS_NOT_FOUND:
MDF_LOGW("edge_ip is not initialized yet!");
break;
default :
MDF_LOGE("Error (%s) reading edge_ip!", esp_err_to_name(err));
}
err = nvs_get_u16(handle, "edge_port", &edge_port);
switch (err)
{
case ESP_OK:
MDF_LOGI("edge_port = %d", edge_port);
break;
case ESP_ERR_NVS_NOT_FOUND:
MDF_LOGW("edge_port is not initialized yet!");
break;
default :
MDF_LOGE("Error (%s) reading edge_port!", esp_err_to_name(err));
}
nvs_get_str(handle, "conf_wifi", NULL, &required_size);
configured_wifi = (char*) malloc(required_size);
err = nvs_get_str(handle, "conf_wifi", configured_wifi, &required_size);
switch (err)
{
case ESP_OK:
MDF_LOGI("conf_wifi = %s", configured_wifi);
break;
case ESP_ERR_NVS_NOT_FOUND:
MDF_LOGW("conf_wifi is not initialized yet!");
break;
default :
MDF_LOGE("Error (%s) reading conf_wifi!", esp_err_to_name(err));
}
nvs_get_str(handle, "conf_wifi_pass", NULL, &required_size);
configured_wifi_password = (char*) malloc(required_size);
err = nvs_get_str(handle, "conf_wifi_pass", configured_wifi_password, &required_size);
switch (err)
{
case ESP_OK:
MDF_LOGI("conf_wifi_pass = %s", configured_wifi_password);
break;
case ESP_ERR_NVS_NOT_FOUND:
MDF_LOGW("conf_wifi_pass is not initialized yet!");
break;
default :
MDF_LOGE("Error (%s) reading conf_wifi_pass!", esp_err_to_name(err));
}
nvs_get_str(handle, "conf_mesh_id", NULL, &required_size);
configured_mesh_id = (char*) malloc(required_size);
err = nvs_get_str(handle, "conf_mesh_id", configured_mesh_id, &required_size);
switch (err)
{
case ESP_OK:
MDF_LOGI("conf_mesh_id = %s", configured_mesh_id);
break;
case ESP_ERR_NVS_NOT_FOUND:
MDF_LOGW("conf_mesh_id is not initialized yet!");
break;
default :
MDF_LOGE("Error (%s) reading conf_mesh_id!", esp_err_to_name(err));
}
strcpy(config.router_ssid, configured_wifi);
strcpy(config.router_password, configured_wifi_password);
memcpy(config.mesh_id, configured_mesh_id, sizeof(config.mesh_id));
strcpy(config.mesh_password, CONFIG_MESH_PASSWORD);
MDF_LOGI("CHANNEL NUMBER: %d", config.channel);
nvs_close(handle);
}
else
{
//set default values
MDF_LOGI("Setting default values");
strcpy(config.router_ssid, CONFIG_ROUTER_SSID);
strcpy(config.router_password, CONFIG_ROUTER_PASSWORD);
memcpy(config.mesh_id, CONFIG_MESH_ID, sizeof(config.mesh_id));
strcpy(config.mesh_password, CONFIG_MESH_PASSWORD);
}
}
esp_log_level_set("*", ESP_LOG_INFO);
esp_log_level_set(TAG, ESP_LOG_DEBUG);
MDF_ERROR_ASSERT(mdf_event_loop_init(event_loop_cb));
MDF_ERROR_ASSERT(wifi_init()); ///////////PROGRAM FAILES SOMEWHERE HERE
MDF_ERROR_ASSERT(mwifi_init(&cfg));
MDF_ERROR_ASSERT(mwifi_set_config(&config));
MDF_ERROR_ASSERT(mwifi_start());
initialize_sntp();
uint8_t sta_mac[MWIFI_ADDR_LEN] = {0};
esp_wifi_get_mac(WIFI_IF_STA, sta_mac);
asprintf(&mac_address, MACSTR, MAC2STR(sta_mac));
if( get_time_ms() > 10000000000)
{
sales_measurment = 1;
}
MDF_LOGW("Starting Tasks");
TaskHandle_t xHandle_VL53L0X = NULL;
TaskHandle_t xHandle_communication = NULL;
//xTaskCreate(VL53L0X_task, "VL53L0X_task", 4 * 1024, NULL, 4, NULL);
xTaskCreate(communication_task, "communication_task", 4 * 1024, NULL, 6, NULL);
xTaskCreate(VL53L0X_task, "VL53L0X_task", 4 * 1024, NULL, 4, &xHandle_VL53L0X);
//xTaskCreate(communication_task, "communication_task", 2 * 1024, NULL, 6, &xHandle_communication);
/*
xHandle_communication = xTaskCreateStatic(
communication_task,
"communication_task",
4 * 1024,
( void * ) 1,
6,
xStack,
&xTaskBuffer );*/
xTaskCreate(input_voltage_adc_task, "input_voltage_adc_task", 4 * 1024, NULL, 2, NULL);
//xTaskCreate(RTC_task, "RTC_task", 4 * 1024, NULL, 1, NULL);
MDF_ERROR_ASSERT( esp_task_wdt_init(100,1) );
MDF_ERROR_ASSERT( esp_task_wdt_add(xHandle_VL53L0X) );
//MDF_ERROR_ASSERT( esp_task_wdt_add(xHandle_communication) );
TimerHandle_t system_info_timer = xTimerCreate("print_system_info", 5000 / portTICK_RATE_MS,
true, NULL, print_system_info_timercb);
xTimerStart(system_info_timer, 0);
if ( edge_configured )
{
TimerHandle_t additional_info_timer = xTimerCreate("print_additional_info", 15000 / portTICK_RATE_MS,
true, NULL, print_additional_info_timercb);
xTimerStart(additional_info_timer, 0);
}
}
2. I guess I tried to increase the stack before. Tomorrow I will have access to the device and will try again.