how can disable watchdog

kishan patel
Posts: 43
Joined: Wed Aug 30, 2017 4:56 am

how can disable watchdog

Postby kishan patel » Tue Dec 12, 2017 12:50 pm

Hello,
Sometimes,my system has restart due to watchdog.Debug print can see as below:

rst:0x8 (TG1WDT_SYS_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)

So,what would be the reason to reset the system.
Any functions to disable watchdog.

User avatar
urbanze
Posts: 162
Joined: Sat Jun 10, 2017 9:55 pm
Location: Brazil

Re: how can disable watchdog

Postby urbanze » Wed Dec 13, 2017 7:08 pm

kishan patel wrote:Hello,
Sometimes,my system has restart due to watchdog.Debug print can see as below:

rst:0x8 (TG1WDT_SYS_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)

So,what would be the reason to reset the system.
Any functions to disable watchdog.


You tried to disable both wdt (INT/TASK) by menuconfig?

kishan patel
Posts: 43
Joined: Wed Aug 30, 2017 4:56 am

Re: how can disable watchdog

Postby kishan patel » Thu Dec 14, 2017 4:59 am

I have checked Menuconfig.
How can i disabled it?
Which key i have to press to remove '*' ?.......
I have attached one image.Please,check it.
Attachments
MAKE_MENUCONFIG.png
MAKE_MENUCONFIG.png (172.64 KiB) Viewed 776 times

ESP_Sprite
Posts: 1622
Joined: Thu Nov 26, 2015 4:08 am

Re: how can disable watchdog

Postby ESP_Sprite » Thu Dec 14, 2017 8:43 am

Arrow keys move around, space selects/deselects.

I suggest, however, that you find out what causes the watchdog to trigger: chances are that with the watchdog disables, you end up with an unresponsive ESP32 instead of a rebooting ESP32.

kishan patel
Posts: 43
Joined: Wed Aug 30, 2017 4:56 am

Re: how can disable watchdog

Postby kishan patel » Thu Dec 14, 2017 10:29 am

Okay.
Thanks for reply.
Means if i will find the reason behind triggering watchdog.It is better than disable by menuconfig. Right?.

ESP_Sprite
Posts: 1622
Joined: Thu Nov 26, 2015 4:08 am

Re: how can disable watchdog

Postby ESP_Sprite » Thu Dec 14, 2017 11:11 am

I wouldn't say 'better'. I would say that is likely the only way to get your program to work.

User avatar
urbanze
Posts: 162
Joined: Sat Jun 10, 2017 9:55 pm
Location: Brazil

Re: how can disable watchdog

Postby urbanze » Thu Dec 14, 2017 1:22 pm

The watchdog that is resetting its code is the timer (group 1). I advise you to review your code if you are using something with timer's or related

kishan patel
Posts: 43
Joined: Wed Aug 30, 2017 4:56 am

Re: how can disable watchdog

Postby kishan patel » Fri Dec 15, 2017 5:06 am

Hello friends,
Now,i am very near about this issue.I am sending you some code and its output so,you can also understand.
If any mistake or something let me check.

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 (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);

#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_RESPONSE)
ESP_LOGI(Display,"\nresponse_buffer=%s\n",response_buffer);
#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);
}
}


This is code about the process of sending data to the server.
Before i have not added below line to debug.

#if (defined WIFI_DEBUG_PRINT) && (defined WIFI_SERVER_LINK_STATUS)
ESP_LOGI(Display, "\n\nselect returns= %d\n\n",rv);
#endif

so,when my device was hang then i can read debug print continuously as below:

ask watchdog got triggered. The following tasks did not feed the watchdog in time:
Tasks currently running:
CPU 0: main


now,i can see debug print as below:


ask 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


I (9681543) WIFI >> DEBUG-PRINT:

select returns= 1


I (9681549) WIFI >> DEBUG-PRINT:

select returns= 1


I (9681555) WIFI >> DEBUG-PRINT:

select returns= 1


I (9681562) WIFI >> DEBUG-PRINT:

select returns= 1

Means my device has hanging in this do while loop.
But i have not used TIMER_GROUP1

see my timer code as below:

#define TIMER_GROUP TIMER_GROUP_0
#define TIMER_ID TIMER_0

void timer_init_kt(void)
{
timer_config_t timer_config;

timer_config.alarm_en = 0;
timer_config.auto_reload = 1;
timer_config.counter_dir = TIMER_COUNT_UP;
timer_config.divider = 16;
timer_config.intr_type = TIMER_INTR_LEVEL;
timer_config.counter_en = TIMER_START;

timer_init(TIMER_GROUP,TIMER_ID,&timer_config);
}

Please,tell me if any suggestions.

Who is online

Users browsing this forum: No registered users and 7 guests