mDNS causes restarting on esp8266

1

I am working on esp8266. I have builded and flashed the esphttpd webserver. Then I have added a piece of code to start mdns on esp8266:

static void ICACHE_FLASH_ATTR mdns()
{
 struct ip_info ipConfig;
 struct mdns_info *info = (struct mdns_info *)os_zalloc(sizeof(struct mdns_info));

 wifi_get_ip_info(STATION_IF, &ipConfig);
 if (!(wifi_station_get_connect_status() == STATION_GOT_IP && ipConfig.ip.addr != 0)) {
  os_printf("Cannot read station configuration\n");
  return;
 }

 info->host_name = (char *) "lienka";
 info->ipAddr = ipConfig.ip.addr; //ESP8266 station IP
 info->server_name = "module01";
 info->server_port = 80;
 info->txt_data[0] = "version = now";
 info->txt_data[1] = "user1 = data1";
 info->txt_data[2] = "user2 = data2";

 info->txt_data[3] = "vendor = me";
 espconn_mdns_init(info);
 //espconn_mdns_server_register();
 espconn_mdns_enable();
}

static void ICACHE_FLASH_ATTR testTimerCb(void *arg) {
 mdns();
}

In the user_init function the following code was added:

os_timer_disarm(&testTimer);
os_timer_setfn(&testTimer, testTimerCb, NULL);
os_timer_arm(&testTimer, 10000, 0);

The problem is that since I have added the mdns functionality, the esp8266 is restarting every minute. When these 3 lines of code in user_init function is commented out, esp8266 stops restarting itself.

Logs when ESP is restarting:

3fff0e50 already freed
3fff0e50 already freed
Fatal exception 0(IllegalInstructionCause):
epc1=0x40107cba, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

 ets Jan  8 2013,rst cause:1, boot mode:(3,0)

load 0x40100000, len 32264, room 16 
tail 8
chksum 0x13
load 0x3ffe8000, len 2316, room 0 
tail 12
chksum 0x9f
ho 0 tail 12 room 4
load 0x3ffe8910, len 6456, room 12 
tail 12
chksum 0x30
csum 0x30
rl⸮⸮rl⸮⸮Httpd init

Could anybody help me, what should I do?

c
webserver
esp8266
mdns
asked on Stack Overflow Jan 14, 2019 by adamhala007

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0