ESP-IDF template not working?
Posted: Sun Jan 08, 2017 7:38 pm
Hello
I just install ESP-IDF with Eclipse and I compiled template project and upload it to ESP32. It runs on ESP and terminal output changes then i change printf strings in main.c.
I changed SSID and password for connect to my home AP but ESP not connects to my AP.
In terminal i take:
Then i change code to work as AP:
In terminal i take:
But ESP's AP is not in AP list.
Also i try this WiFi scan example (https://github.com/VALERE91/ESP32_WifiScan) and it works fine.
I just install ESP-IDF with Eclipse and I compiled template project and upload it to ESP32. It runs on ESP and terminal output changes then i change printf strings in main.c.
I changed SSID and password for connect to my home AP but ESP not connects to my AP.
In terminal i take:
Code: Select all
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3ffc0008,len:4
load:0x3ffc000c,len:2364
load:0x40078000,len:3724
ho 0 tail 12 room 4
load:0x40080000,len:260
entry 0x40080034
I (721) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (722) heap_alloc_caps: At 3FFBD95C len 000226A4 (137 KiB): DRAM
I (726) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (736) heap_alloc_caps: At 4009BC14 len 000043EC (16 KiB): IRAM
I (746) cpu_start: Pro cpu up.
I (752) cpu_start: Single core mode
I (758) cpu_start: Pro cpu start user code
I (1006) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0
I (1563) cpu_start: Starting scheduler on PRO CPU.
tcpip_task_hdlxxx : 3ffc134c, prio:18,stack:2048
I (1576) wifi: frc2_timer_task_hdl:3ffc2e40, prio:22, stack:2048
I (1585) wifi: pp_task_hdl : 3ffc5aa4, prio:23, stack:8192
I (1586) wifi: mode : sta (24:0a:c4:03:ee:9c)
Code: Select all
#include "esp_wifi.h"
#include "esp_system.h"
#include "esp_event.h"
#include "esp_event_loop.h"
#include "nvs_flash.h"
esp_err_t event_handler(void *ctx, system_event_t *event)
{
return ESP_OK;
}
int 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_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM));
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP));
wifi_config_t ap_config = {
.ap = {
.ssid = "Test123",
.password = "test1234",
.ssid_len = 0, /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */
.channel = 0, /**< Channel of ESP32 soft-AP */
.authmode = WIFI_AUTH_OPEN, /**< Auth mode of ESP32 soft-AP. Do not support AUTH_WEP in soft-AP mode */
.ssid_hidden = 0, /**< Broadcast SSID or not, default 0, broadcast the SSID */
.max_connection = 4, /**< Max number of stations allowed to connect in, default 4, max 4 */
.beacon_interval = 100 /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */ }
};
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_AP, &ap_config) );
ESP_ERROR_CHECK( esp_wifi_start() );
gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT);
int level = 0;
while (true) {
gpio_set_level(GPIO_NUM_4, level);
level = !level;
vTaskDelay(300 / portTICK_PERIOD_MS);
}
return 0;
}
Code: Select all
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3ffc0008,len:4
load:0x3ffc000c,len:2364
load:0x40078000,len:3724
ho 0 tail 12 room 4
load:0x40080000,len:260
entry 0x40080034
I (720) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (721) heap_alloc_caps: At 3FFBD95C len 000226A4 (137 KiB): DRAM
I (725) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (735) heap_alloc_caps: At 4009BC14 len 000043EC (16 KiB): IRAM
I (745) cpu_start: Pro cpu up.
I (751) cpu_start: Single core mode
I (757) cpu_start: Pro cpu start user code
I (1003) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0
I (1542) cpu_start: Starting scheduler on PRO CPU.
tcpip_task_hdlxxx : 3ffc134c, prio:18,stack:2048
I (1555) wifi: frc2_timer_task_hdl:3ffc2e40, prio:22, stack:2048
I (1564) wifi: pp_task_hdl : 3ffc5aa4, prio:23, stack:8192
I (1565) wifi: mode : softAP (24:0a:c4:03:ee:9d)
dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1)
Also i try this WiFi scan example (https://github.com/VALERE91/ESP32_WifiScan) and it works fine.