Code: Select all
static const char *TAG = "test";
esp_err_t event_handler(void *ctx, system_event_t *event)
{
ESP_LOGI(TAG, ">>>event_handler: %d", event->event_id); //ss
return ESP_OK;
}
void app_main(void)
{
nvs_flash_init();
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_LOGI(TAG, ">>>restore: "); //ss
// ESP_ERROR_CHECK( esp_wifi_restore());
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
wifi_config_t sta_config = {
.sta = {
.ssid = "XXXSSID",
.password = "xxxpw",
.bssid_set = false
}
};
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &sta_config) );
ESP_ERROR_CHECK( esp_wifi_start() );
ESP_ERROR_CHECK( esp_wifi_connect() );
Code: Select all
MONITOR
--- idf_monitor on COM13 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_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:0x3fff0010,len:4
load:0x3fff0014,len:4340
load:0x40078000,len:0
load:0x40078000,len:11312
entry 0x40078c98
I (863) heap_init: Initializing. RAM available for dynamic allocation:
I (864) heap_init: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM
I (882) heap_init: At 3FFB75C8 len 00028A38 (162 KiB): DRAM
I (939) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (998) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1057) heap_init: At 4009298C len 0000D674 (53 KiB): IRAM
I (1282) wifi: wifi firmware version: b39ed32
I (1282) wifi: config NVS flash: enabled
I (1282) wifi: config nano formating: disabled
I (1288) wifi: Init dynamic tx buffer num: 32
I (1288) wifi: Init data frame dynamic rx buffer num: 32
I (1292) wifi: Init management frame dynamic rx buffer num: 32
I (1298) wifi: wifi driver task: 3ffbbfec, prio:23, stack:4096
I (1303) wifi: Init static rx buffer num: 10
I (1307) wifi: Init dynamic rx buffer num: 32
I (1311) wifi: Init rx ampdu len mblock:7
I (1315) wifi: Init lldesc rx ampdu entry mblock:4
I (1320) wifi: wifi power manager task: 0x3ffc1360 prio: 21 stack: 2560
I (1327) wifi: wifi timer task: 3ffc23dc, prio:22, stack:3584
I (1351) wifi: Init Ampdu: 1 tx baw=6 rx baw=6
I (1351) wifi: mode : sta (24:0a:c4:06:f4:98)
I (1352) test: >>>event_handler: 2
I (2076) wifi: n:6 0, o:1 0, ap:255 255, sta:6 0, prof:1
I (2077) wifi: state: init -> auth (b0)
I (2081) wifi: state: auth -> assoc (0)
I (2090) wifi: state: assoc -> run (10)
I (2091) wifi: connected with XXXSSID, channel 6
I (2094) test: >>>event_handler: 4
I (2786) test: >>>event_handler: 7
I (12091) wifi: pm start, type:0
I (12092) wifi: active cnt: 13
Code: Select all
MONITOR
--- idf_monitor on COM13 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_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:0x3fff0010,len:4
load:0x3fff0014,len:4340
load:0x40078000,len:0
load:0x40078000,len:11312
entry 0x40078c98
I (862) heap_init: Initializing. RAM available for dynamic allocation:
I (863) heap_init: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM
I (881) heap_init: At 3FFB75C8 len 00028A38 (162 KiB): DRAM
I (939) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (997) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1057) heap_init: At 4009298C len 0000D674 (53 KiB): IRAM
I (1283) wifi: wifi firmware version: b39ed32
I (1283) wifi: config NVS flash: enabled
I (1284) wifi: config nano formating: disabled
I (1289) wifi: Init dynamic tx buffer num: 32
I (1289) wifi: Init data frame dynamic rx buffer num: 32
I (1293) wifi: Init management frame dynamic rx buffer num: 32
I (1299) wifi: wifi driver task: 3ffbbfec, prio:23, stack:4096
I (1305) wifi: Init static rx buffer num: 10
I (1308) wifi: Init dynamic rx buffer num: 32
I (1313) wifi: Init rx ampdu len mblock:7
I (1316) wifi: Init lldesc rx ampdu entry mblock:4
I (1321) wifi: wifi power manager task: 0x3ffc1360 prio: 21 stack: 2560
I (1327) test: >>>restore:
I (1342) wifi: wifi timer task: 3ffc15d8, prio:22, stack:3584
I (1364) wifi: Init Ampdu: 1 tx baw=6 rx baw=6
I (1364) wifi: mode : sta (24:0a:c4:06:f4:98)
I (1365) test: >>>event_handler: 2
I (2089) wifi: n:6 0, o:1 0, ap:255 255, sta:6 0, prof:1
I (2090) wifi: state: init -> auth (b0)
I (3090) wifi: state: auth -> init (2)
I (3091) wifi: n:6 0, o:6 0, ap:255 255, sta:6 0, prof:1