espressif / ESP8266_RTOS_SDK

Latest ESP8266 SDK based on FreeRTOS, esp-idf style.
http://bbs.espressif.com
Apache License 2.0
3.33k stars 1.57k forks source link

Guru Meditation Error when enable promiscuous mode!!!(GIT8266O-259) #694

Open zebin-wu opened 5 years ago

zebin-wu commented 5 years ago

Environment

Problem Description

Guru Meditation Error when enable promiscuous mode!!!

Expected Behavior

Running nomal

Actual Behavior

Crash in ppT task.

Steps to repropduce

Running sample in example/wifi/smart_config, then airkiss. Another one that I do nothing in promiscuous rx handle, it also crash.

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_wifi.h"
#include "nvs_flash.h"
#include "esp_event_loop.h"

int cur_channel = 1;

void switch_channel_task(void * args)
{
    while (1) {
        if (cur_channel >= 13) {
            cur_channel = 1;
        } else {
            cur_channel++;
        }
        ESP_ERROR_CHECK( esp_wifi_set_channel(cur_channel, WIFI_SECOND_CHAN_NONE) );
        vTaskDelay(100 / portTICK_RATE_MS);
    }
}

static esp_err_t event_handler(void *ctx, system_event_t *event)
{
    /* For accessing reason codes in case of disconnection */
    system_event_info_t *info = &event->event_info;

    return ESP_OK;
}

void wifi_promiscuous_handle(void *buf, wifi_promiscuous_pkt_type_t type)
{
    //nothing
    //printf("rx data\n");
}

void init_wifi(void)
{
    tcpip_adapter_init();
    ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));
    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();

    ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
    ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
    ESP_ERROR_CHECK( esp_wifi_start() );
    ESP_ERROR_CHECK( esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_handle) );
    ESP_ERROR_CHECK( esp_wifi_set_promiscuous(true) );

    xTaskCreate(switch_channel_task, "switch", 2048, NULL, 3, NULL);
}

void app_main()
{
    ESP_ERROR_CHECK( nvs_flash_init() );
    init_wifi();
}

Debug Logs

Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x40101379  PS      : 0x00000033  A0      : 0x40101303  A1      : 0x3fff29b0  
0x40101379: _heap_caps_free at /Users/zebin/Documents/esp/ESP8266_RTOS_SDK/components/heap/src/esp_heap_caps.c:277

0x40101303: blk_link_size at /Users/zebin/Documents/esp/ESP8266_RTOS_SDK/components/heap/port/esp8266/include/priv/esp_heap_caps_priv.h:100
 (inlined by) _heap_caps_free at /Users/zebin/Documents/esp/ESP8266_RTOS_SDK/components/heap/src/esp_heap_caps.c:255

A2      : 0x007a0064  A3      : 0x80000000  A4      : 0x007a0064  A5      : 0x3ffebf9c  
A6      : 0xbffebe74  A7      : 0x007a0064  A8      : 0x000000ff  A9      : 0x000000a5  
A10     : 0x00000001  A11     : 0xffffffff  A12     : 0x3ffebf9c  A13     : 0x00000001  
A14     : 0x00000000  A15     : 0x00000004  SAR     : 0x0000001e  EXCCAUSE: 0x0000001c  

0x40101379: _heap_caps_free at /Users/zebin/Documents/esp/ESP8266_RTOS_SDK/components/heap/src/esp_heap_caps.c:277

0x4024fa52: ppProcessRxPktHdr at ??:?

0x40250d57: ppTask at ??:?
zebin-wu commented 5 years ago

Can you help me with this problem? @donghengqaz