reason for watchdog trigger.
-
- Posts: 45
- Joined: Wed Aug 30, 2017 4:56 am
reason for watchdog trigger.
Hello,
I have some querry about watchdog.
I have using esp-wroom-32 and sometimes i got that my system is hang-up.
When i have checking debug print,i find something as below:
Task watchdog got triggered. The following tasks did not feed the watchdog in time:
Tasks currently running:
CPU 0: main
So,when this type of debug occur.
How can i solved that?
Please,tell me if any issue or any configuration steps required.
I have some querry about watchdog.
I have using esp-wroom-32 and sometimes i got that my system is hang-up.
When i have checking debug print,i find something as below:
Task watchdog got triggered. The following tasks did not feed the watchdog in time:
Tasks currently running:
CPU 0: main
So,when this type of debug occur.
How can i solved that?
Please,tell me if any issue or any configuration steps required.
Re: reason for watchdog trigger.
Can you post your main task?
Probably your app_main()
Probably your app_main()
-
- Posts: 45
- Joined: Wed Aug 30, 2017 4:56 am
Re: reason for watchdog trigger.
Thanks for reply,
I can send main task.But it is around 2000 lines.So,i am tell process what i have doing.
Initialize all thing before doing any process.
Initialize uart,
Initialize PWM for buzzer,
Initialize wifi,
Initialize ble,
Initialize timer,
Initialize ADC.
I have get some data and send to the server.
In which process you think about WATCHDOG issue,i will send code for that thing like as any wrong to initialize or something.
I can send main task.But it is around 2000 lines.So,i am tell process what i have doing.
Initialize all thing before doing any process.
Initialize uart,
Initialize PWM for buzzer,
Initialize wifi,
Initialize ble,
Initialize timer,
Initialize ADC.
I have get some data and send to the server.
In which process you think about WATCHDOG issue,i will send code for that thing like as any wrong to initialize or something.
Re: reason for watchdog trigger.
This is what i would do:
- spread ESP_LOG every few lines to find out approximatly where this watchdog occurs
- then find exactly line that causing watchdog triggering
Its some work with 2000 lines but in 1-2 hours you can find it out
- spread ESP_LOG every few lines to find out approximatly where this watchdog occurs
- then find exactly line that causing watchdog triggering
Its some work with 2000 lines but in 1-2 hours you can find it out
-
- Posts: 45
- Joined: Wed Aug 30, 2017 4:56 am
Re: reason for watchdog trigger.
I am sending log.
Please check it.
[0;32mI (6580427) WIFI >> DEBUG-PRINT: Connected to AP[0m
[0;32mI (6580433) WIFI >> DEBUG-PRINT: DNS lookup succeeded. IP=13.58.4.12[0m
[0;32mI (6580440) WIFI >> DEBUG-PRINT:
socket_id = 0
[0m
[0;32mI (6580445) WIFI >> DEBUG-PRINT: ... allocated socket
[0m
I (6581101) wifi: active cnt: 16
[0;32mI (6581486) WIFI >> DEBUG-PRINT: ... connected[0m
[0;32mI (6581488) WIFI >> DEBUG-PRINT: ... socket send success[0m
ets Jun 8 2016 00:22:57
rst:0x8 (TG1WDT_SYS_RESET),boot:0x12 (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:4252
load:0x40078000,len:0
load:0x40078000,len:11016
entry 0x40078be8
[0;33mW (89) boot: PRO CPU has been reset by WDT.[0m
[0;33mW (89) boot: WDT reset info: PRO CPU PC=0x400884ed[0m
[0;33mW (90) boot: WDT reset info: APP CPU PC=0xd7fdbefa[0m
[0;32mI (1132) heap_init: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (1132) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM[0m
[0;32mI (1139) heap_init: At 3FFD2170 len 0000DE90 (55 KiB): DRAM[0m
[0;32mI (1158) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[0;32mI (1178) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (1198) heap_init: At 40094708 len 0000B8F8 (46 KiB): IRAM[0m
[0;31mE (1257) MAIN >> DEBUG-PRINT:
...................TASK INVALID...................
[0m
E (1257) wifi: esp_wifi_stop 801 wifi is not init
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x12 (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:4252
load:0x40078000,len:0
load:0x40078000,len:11016
entry 0x40078be8
[0;32mI (1068) heap_init: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (1069) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM[0m
[0;32mI (1075) heap_init: At 3FFD2170 len 0000DE90 (55 KiB): DRAM[0m
[0;32mI (1095) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[0;32mI (1114) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (1134) heap_init: At 40094708 len 0000B8F8 (46 KiB): IRAM[0m
[0;31mE (1193) MAIN >> DEBUG-PRINT:
...................TASK SOFTWARE_RESET...................
[0m
[0;32mI (1194) MAIN >> DEBUG-PRINT:
after software reset
car_battery_voltage = 0.000000
[0m
ets Jun 8 2016 00:22:57
rst:0x5 (DEEPSLEEP_RESET),boot:0x12 (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:4252
load:0x40078000,len:0
load:0x40078000,len:11016
entry 0x40078be8
[0;32mI (1069) heap_init: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (1069) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM[0m
[0;32mI (1076) heap_init: At 3FFD2170 len 0000DE90 (55 KiB): DRAM[0m
[0;32mI (1095) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[0;32mI (1115) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (1135) heap_init: At 40094708 len 0000B8F8 (46 KiB): IRAM[0m
[0;31mE (1194) MAIN >> DEBUG-PRINT:
...................TASK DEEP_SLEEP_RESET...................
[0m
[0;31mE (2495) MAIN >> DEBUG-PRINT:
...................TASK POWER_ON_RESET...................
[0m
[0;33mW (2495) MAIN >> DEBUG-PRINT:
going for board initialization
Here when sending data to server,system was reset.
Please check it.
[0;32mI (6580427) WIFI >> DEBUG-PRINT: Connected to AP[0m
[0;32mI (6580433) WIFI >> DEBUG-PRINT: DNS lookup succeeded. IP=13.58.4.12[0m
[0;32mI (6580440) WIFI >> DEBUG-PRINT:
socket_id = 0
[0m
[0;32mI (6580445) WIFI >> DEBUG-PRINT: ... allocated socket
[0m
I (6581101) wifi: active cnt: 16
[0;32mI (6581486) WIFI >> DEBUG-PRINT: ... connected[0m
[0;32mI (6581488) WIFI >> DEBUG-PRINT: ... socket send success[0m
ets Jun 8 2016 00:22:57
rst:0x8 (TG1WDT_SYS_RESET),boot:0x12 (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:4252
load:0x40078000,len:0
load:0x40078000,len:11016
entry 0x40078be8
[0;33mW (89) boot: PRO CPU has been reset by WDT.[0m
[0;33mW (89) boot: WDT reset info: PRO CPU PC=0x400884ed[0m
[0;33mW (90) boot: WDT reset info: APP CPU PC=0xd7fdbefa[0m
[0;32mI (1132) heap_init: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (1132) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM[0m
[0;32mI (1139) heap_init: At 3FFD2170 len 0000DE90 (55 KiB): DRAM[0m
[0;32mI (1158) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[0;32mI (1178) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (1198) heap_init: At 40094708 len 0000B8F8 (46 KiB): IRAM[0m
[0;31mE (1257) MAIN >> DEBUG-PRINT:
...................TASK INVALID...................
[0m
E (1257) wifi: esp_wifi_stop 801 wifi is not init
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x12 (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:4252
load:0x40078000,len:0
load:0x40078000,len:11016
entry 0x40078be8
[0;32mI (1068) heap_init: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (1069) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM[0m
[0;32mI (1075) heap_init: At 3FFD2170 len 0000DE90 (55 KiB): DRAM[0m
[0;32mI (1095) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[0;32mI (1114) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (1134) heap_init: At 40094708 len 0000B8F8 (46 KiB): IRAM[0m
[0;31mE (1193) MAIN >> DEBUG-PRINT:
...................TASK SOFTWARE_RESET...................
[0m
[0;32mI (1194) MAIN >> DEBUG-PRINT:
after software reset
car_battery_voltage = 0.000000
[0m
ets Jun 8 2016 00:22:57
rst:0x5 (DEEPSLEEP_RESET),boot:0x12 (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:4252
load:0x40078000,len:0
load:0x40078000,len:11016
entry 0x40078be8
[0;32mI (1069) heap_init: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (1069) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM[0m
[0;32mI (1076) heap_init: At 3FFD2170 len 0000DE90 (55 KiB): DRAM[0m
[0;32mI (1095) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[0;32mI (1115) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (1135) heap_init: At 40094708 len 0000B8F8 (46 KiB): IRAM[0m
[0;31mE (1194) MAIN >> DEBUG-PRINT:
...................TASK DEEP_SLEEP_RESET...................
[0m
[0;31mE (2495) MAIN >> DEBUG-PRINT:
...................TASK POWER_ON_RESET...................
[0m
[0;33mW (2495) MAIN >> DEBUG-PRINT:
going for board initialization
Here when sending data to server,system was reset.
-
- Posts: 45
- Joined: Wed Aug 30, 2017 4:56 am
Re: reason for watchdog trigger.
You can also see the code for sending data to the server.
I think there are some issue.
Here,i have using select function for time_out purpose because read function is blockable.
I think there are some issue.
Here,i have using select function for time_out purpose because read function is blockable.
Code: Select all
void wifi_send_data_kt(char *wifi_data_send)
{
const struct addrinfo hints = {
.ai_family = AF_INET,
.ai_socktype = SOCK_STREAM,
};
struct addrinfo *res;
struct in_addr *addr;
int s;
fd_set readfds;
struct timeval tv;
int rv, n;
char recv_buf[550];
memset(response_buffer,'\0',strlen(response_buffer));
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,false, true, 6000 / portTICK_PERIOD_MS);
#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_LINK_STATUS)
ESP_LOGI(Display, "Connected to AP");
#endif
int err = getaddrinfo(WEB_SERVER,WEB_PORT, &hints, &res);
if(err == 0 || res != NULL)
{
addr = &((struct sockaddr_in *)res->ai_addr)->sin_addr;
#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_LINK_STATUS)
ESP_LOGI(Display, "DNS lookup succeeded. IP=%s", inet_ntoa(*addr));
#endif
s = socket(res->ai_family, res->ai_socktype, 0);
#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_LINK_STATUS)
ESP_LOGI(Display,"\nsocket_id = %d\n",s);
#endif
if(s >= 0)
{
FD_ZERO(&readfds);
FD_SET(s, &readfds);
n = s + 1;
tv.tv_sec = 2;
tv.tv_usec = 000000;
#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_LINK_STATUS)
ESP_LOGI(Display, "... allocated socket\r\n");
#endif
if(connect(s, res->ai_addr, res->ai_addrlen) == 0)
{
//flags = fcntl(s, F_GETFL, 0);
//fcntl(s, F_SETFL, flags | O_NONBLOCK);
#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_LINK_STATUS)
ESP_LOGI(Display, "... connected");
#endif
freeaddrinfo(res);
if (write(s, wifi_data_send, strlen(wifi_data_send)) >= 0)
{
#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_LINK_STATUS)
ESP_LOGI(Display, "... socket send success");
#endif
do{
rv = select(n, &readfds, NULL, NULL, &tv);
if (rv > 0)
{
if (FD_ISSET(s, &readfds))
{
bzero(recv_buf, sizeof(recv_buf));
read(s, recv_buf, sizeof(recv_buf)-1);
strcat(response_buffer,recv_buf);
}
}
}while(rv>0);
#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_RESPONSE)
ESP_LOGI(Display,"\nresponse_buffer=%s\n",response_buffer);
#endif
//#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_LINK_STATUS)
//ESP_LOGI(Display, "\n... done reading from socket. Last read return=%d errno=%d\r\n", r, errno );
//#endif
//-------check that server has saved client data or not-------//
if(strstr(response_buffer,"data saved"))
{
server_saved_data_flag = True;
// #ifdef TEST_CASES_INDICATION
indicate_server_communication_done_kt();
// #endif
}
else
{
server_saved_data_flag = False;
#ifdef TEST_CASES_INDICATION
indicate_server_communication_issue_kt();
#endif
}
//------------------------------------------------------------//
if(strstr(response_buffer,"deactivated"))
{
#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_RESPONSE)
ESP_LOGE(Display,"\nsystem is deactivated\n");
#endif
paired_tags_status = DEACTIVATED;
system_software_reset_kt();
}
else
paired_tags_status = ACTIVATED;
}
else
{
#ifdef TEST_CASES_INDICATION
indicate_server_communication_issue_to_write_kt();
#endif
server_saved_data_flag = False; // server has been not saved client data
}
}
else
{
#ifdef TEST_CASES_INDICATION
indicate_server_connection_issue_kt();
#endif
server_saved_data_flag = False; // server has been not saved client data
}
}
else
server_saved_data_flag = False; // server has been not saved client data
close(s);
}
else
{
server_saved_data_flag = False; // server has been not saved client data
freeaddrinfo(res);
}
}
Re: reason for watchdog trigger.
Add some debug to the do while loop
-
- Posts: 45
- Joined: Wed Aug 30, 2017 4:56 am
Re: reason for watchdog trigger.
okay,i have added debug print in do while loop.
Some time system has hang and when i can try to check debug log,i can see as below:
CPU 0: main
Task watchdog got triggered. The following tasks did not feed the watchdog in time:
Tasks currently running:
so,what should be the reasons behind it.
if any idea please,tell me.
Some time system has hang and when i can try to check debug log,i can see as below:
CPU 0: main
Task watchdog got triggered. The following tasks did not feed the watchdog in time:
Tasks currently running:
so,what should be the reasons behind it.
if any idea please,tell me.
Re: reason for watchdog trigger.
Your last log msg is "ESP_LOGI(Display, "... socket send success");"
WiFive:
This is a loop that can take a while? if the main task isnt sleeping every once in a while, the WDT task watchdog will reset the device.
If this do while loop doesnt sleep somewhere the WDT will trigger (idk if select or read calls vtaskdelay)
Add printlines to your do while loop to check if the WDT is triggered in that loop, and add a vtaskdelay where the WDT is triggered.
more info on WDT: http://esp-idf.readthedocs.io/en/latest ... /wdts.html
WiFive:
Means this loop:Add some debug to the do while loop
Code: Select all
do{
rv = select(n, &readfds, NULL, NULL, &tv);
if (rv > 0)
{
if (FD_ISSET(s, &readfds))
{
bzero(recv_buf, sizeof(recv_buf));
read(s, recv_buf, sizeof(recv_buf)-1);
strcat(response_buffer,recv_buf);
}
}
}while(rv>0);
If this do while loop doesnt sleep somewhere the WDT will trigger (idk if select or read calls vtaskdelay)
Add printlines to your do while loop to check if the WDT is triggered in that loop, and add a vtaskdelay where the WDT is triggered.
more info on WDT: http://esp-idf.readthedocs.io/en/latest ... /wdts.html
-
- Posts: 45
- Joined: Wed Aug 30, 2017 4:56 am
Re: reason for watchdog trigger.
Thanks for reply,
I have added debug print in loop as below:
do{
rv = select(n, &readfds, NULL, NULL, &tv);
#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_LINK_STATUS)
ESP_LOGI(Display, "\n\nselect returns= %d\n\n",rv);
#endif
if (rv > 0)
{
if (FD_ISSET(s, &readfds))
{
bzero(recv_buf, sizeof(recv_buf));
read(s, recv_buf, sizeof(recv_buf)-1);
strcat(response_buffer,recv_buf);
}
}
}while(rv>0);
now,log look like as below:
[0m
[0;3Task watchdog got triggered. The following tasks did not feed the watchdog in time:
Tasks currently running:
CPU 0: main
2mI (9681526) WIFI >> DEBUG-PRINT:
select returns= 1
[0m
[0;32mI (9681543) WIFI >> DEBUG-PRINT:
select returns= 1
[0m
[0;32mI (9681549) WIFI >> DEBUG-PRINT:
select returns= 1
[0m
[0;32mI (9681555) WIFI >> DEBUG-PRINT:
select returns= 1
[0m
[0;32mI (9681562) WIFI >> DEBUG-PRINT:
I have added debug print in loop as below:
do{
rv = select(n, &readfds, NULL, NULL, &tv);
#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_LINK_STATUS)
ESP_LOGI(Display, "\n\nselect returns= %d\n\n",rv);
#endif
if (rv > 0)
{
if (FD_ISSET(s, &readfds))
{
bzero(recv_buf, sizeof(recv_buf));
read(s, recv_buf, sizeof(recv_buf)-1);
strcat(response_buffer,recv_buf);
}
}
}while(rv>0);
now,log look like as below:
[0m
[0;3Task watchdog got triggered. The following tasks did not feed the watchdog in time:
Tasks currently running:
CPU 0: main
2mI (9681526) WIFI >> DEBUG-PRINT:
select returns= 1
[0m
[0;32mI (9681543) WIFI >> DEBUG-PRINT:
select returns= 1
[0m
[0;32mI (9681549) WIFI >> DEBUG-PRINT:
select returns= 1
[0m
[0;32mI (9681555) WIFI >> DEBUG-PRINT:
select returns= 1
[0m
[0;32mI (9681562) WIFI >> DEBUG-PRINT:
Who is online
Users browsing this forum: No registered users and 53 guests