Please help: Unexpected reboot only with "PRO CPU has been reset by WDT" warning

brianC
Posts: 1
Joined: Wed Mar 23, 2022 9:26 am

Please help: Unexpected reboot only with "PRO CPU has been reset by WDT" warning

Postby brianC » Wed Mar 23, 2022 10:12 am

Hi,

I am fairly new to ESP-IDFand ESP32.

I am trying to receive UART packets of 34 bytes at 500Hz with 230400 braud rate. In the Uart RX thread, I also do a bit of data manipulation to make sure that correct data frame can be sent to another thread. The logic is working and I can get correct data frames.

However, I am kept ramdom reboots without any meaningful error displays. The only error message displayed is:

W (45) boot.esp32s3: PRO CPU has been reset by WDT.
W (50) boot.esp32s3: APP CPU has been reset by WDT.

I tried my best to debug and searched the web but no success.

Could any one indicate any clue for me?

Thank you very much in advance.
Brian


ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40041a76
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x1648
load:0x403b6000,len:0xb7c
load:0x403ba000,len:0x2f58
entry 0x403b6248
I (29) boot: ESP-IDF v4.4 2nd stage bootloader
I (29) boot: compile time 15:17:28
I (29) boot: chip revision: 0
I (31) boot.esp32s3: Boot SPI Speed : 80MHz
I (35) boot.esp32s3: SPI Mode : DIO
I (40) boot.esp32s3: SPI Flash Size : 8MB
W (45) boot.esp32s3: PRO CPU has been reset by WDT.
W (50) boot.esp32s3: APP CPU has been reset by WDT.
I (56) boot: Enabling RNG early entropy source...
I (61) boot: Partition Table:
I (65) boot: ## Label Usage Type ST Offset Length
I (72) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (80) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (87) boot: 2 factory factory app 00 00 00010000 00100000
I (95) boot: End of partition table
I (99) esp_image: segment 0: paddr=00010020 vaddr=3c070020 size=14acch ( 84684) map
I (122) esp_image: segment 1: paddr=00024af4 vaddr=3fc95010 size=04094h ( 16532) load
I (126) esp_image: segment 2: paddr=00028b90 vaddr=40374000 size=07488h ( 29832) load
I (135) esp_image: segment 3: paddr=00030020 vaddr=42000020 size=6d530h (447792) map
I (217) esp_image: segment 4: paddr=0009d558 vaddr=4037b488 size=09b80h ( 39808) load
I (226) esp_image: segment 5: paddr=000a70e0 vaddr=50000000 size=00010h ( 16) load
I (233) boot: Loaded app from partition at offset 0x10000
I (233) boot: Disabling RNG early entropy source...
I (246) cpu_start: Pro cpu up.
I (246) cpu_start: Starting app cpu, entry point is 0x40375290

Code: Select all

static void rx_task(void *arg)
{

    uint8_t effective_message[34] = {};
    uint8_t working_message[34] = {};
    uint8_t tx_buffer[34]={};

    static const char *RX_TASK_TAG = "RX_TASK";
    esp_log_level_set(RX_TASK_TAG, ESP_LOG_INFO) ;
    uint8_t* data = (uint8_t*) malloc(RX_BUF_SIZE+1);
    static const int UART_MSG_length = 34; 


    int count = 0; 
    

    queue_msg msg_to_send; 
    msg_to_send.q_sender = robot; 
    bool tag=false;
    udp_send_msg udp_to_send;


    while (1) {

        const int rxBytes = uart_read_bytes(UART_NUM_1, data, 34, 1);
          
        if (rxBytes > 0) {
            data[rxBytes] = 0;
            
            tag=!tag;
            gpio_set_level(GPIO_OUTPUT_IO_1, tag);


            int remaining_bytes = rxBytes; 
            

            if(count >0) 
            {
                
                int required_bytes=UART_MSG_length-count;

                if( required_bytes > rxBytes)
                {
                    memcpy(&working_message[count], data, rxBytes);
                    count = count + rxBytes; 
                }
                else 
                {
                    memcpy(&working_message[count], data, required_bytes);
                    memcpy(data, &data[UART_MSG_length-count], rxBytes-required_bytes);
                    if(working_message[UART_MSG_length-1] == 0x26)
                    {
                        memcpy(msg_to_send.msg_array, working_message, 34);
                        memcpy(udp_to_send.udp_send_array, working_message, 34);
                        xQueueSend(uart_queue, (void*) &msg_to_send, portMAX_DELAY); 
                        xQueueSend(udp_send_queue, (void*) &udp_to_send, portMAX_DELAY);
                    }
                    remaining_bytes = rxBytes-required_bytes; 
                    count = 0 ; 
                    memset(working_message, 0, sizeof(working_message)); 
                }
            }
            
            if(count ==0 && remaining_bytes > 0 )
            {
                for(int i=0; i< rxBytes; i++)
                {
                    if(data[i]==0x2A)
                    {
                        if(rxBytes-i<34)
                        {
                            memcpy(&working_message[0], &data[i], remaining_bytes -i); 
                            count = remaining_bytes -i;  
                        }
                        else
                        {
                            memcpy(working_message, &data[i], UART_MSG_length);
                            if(working_message[UART_MSG_length-1] == 0x26)
                            {
                                memcpy(effective_message, working_message, 34);

                                memcpy(msg_to_send.msg_array, working_message, 34);
                                memcpy(udp_to_send.udp_send_array, working_message, 34);

                                xQueueSend(uart_queue, (void*) &msg_to_send, portMAX_DELAY); 
                                xQueueSend(udp_send_queue, (void*) &udp_to_send, portMAX_DELAY);

                            }
                        }
                        break;
                    } 
                }
            }  
        }  
    }
    free(data);
    free(effective_message); 
    free(working_message);
}

ESP_jakob
Posts: 49
Joined: Mon Jun 01, 2020 6:28 am

Re: Please help: Unexpected reboot only with "PRO CPU has been reset by WDT" warning

Postby ESP_jakob » Wed Mar 23, 2022 10:24 am

Not sure but the warning might be from the task watchdog timer (task WDT). You're using a big while loop inside your main function which never waits long enough to give the idle task a chance to run and feed the WDT.

You can read more about watchdogs in the watchdog documentation: https://docs.espressif.com/projects/esp ... /wdts.html.

In particular, the Task WDT might be interesting: https://docs.espressif.com/projects/esp ... hdog-timer.

johnthebairdsca
Posts: 1
Joined: Sun Apr 02, 2023 4:37 pm

Re: Please help: Unexpected reboot only with "PRO CPU has been reset by WDT" warning

Postby johnthebairdsca » Sun Apr 02, 2023 4:40 pm

Hello,

I am having this exact same issue. What was the resolution?

W (61) boot.esp32: PRO CPU has been reset by WDT.
W (61) boot.esp32: WDT reset info: PRO CPU PC=0x40093a95
W (63) boot.esp32: WDT reset info: APP CPU PC=0x40093e4a

Kindly advise. Thanks.

DarshanDodal
Posts: 1
Joined: Sat Jun 17, 2023 6:01 am

Re: Please help: Unexpected reboot only with "PRO CPU has been reset by WDT" warning

Postby DarshanDodal » Sat Jun 17, 2023 6:04 am

I am facing the same issue.
Can you tell me what has caused the issue in your case?
and Did you find a solution to it?

MikeMyhre
Posts: 54
Joined: Sat Nov 05, 2022 3:32 am

Re: Please help: Unexpected reboot only with "PRO CPU has been reset by WDT" warning

Postby MikeMyhre » Tue Jun 20, 2023 1:42 pm

The issue is that the watchdog is not getting called.
A vTaskDelay( pdMS_TO_TICKS(10) ); needs to be called periodically (with what ever time you want).
If you are doing this in your main loop, it may also be an interrupt that is preventing the main loop from being called (perhaps because the interrupt function doesn't clear the interrupt and it keeps being called over and over).

axellin
Posts: 200
Joined: Mon Sep 17, 2018 9:09 am

Re: Please help: Unexpected reboot only with "PRO CPU has been reset by WDT" warning

Postby axellin » Tue Feb 20, 2024 5:27 am

MikeMyhre wrote:
Tue Jun 20, 2023 1:42 pm
The issue is that the watchdog is not getting called.
A vTaskDelay( pdMS_TO_TICKS(10) ); needs to be called periodically (with what ever time you want).
If you are doing this in your main loop, it may also be an interrupt that is preventing the main loop from being called (perhaps because the interrupt function doesn't clear the interrupt and it keeps being called over and over).
I (40) boot.esp32s3: SPI Flash Size : 8MB
W (45) boot.esp32s3: PRO CPU has been reset by WDT.
W (50) boot.esp32s3: APP CPU has been reset by WDT.

The message is during boot so I don't think this is related to the code in main loop,

DonotTouchMyNotes
Posts: 1
Joined: Mon Jul 22, 2024 1:50 am

Re: Please help: Unexpected reboot only with "PRO CPU has been reset by WDT" warning

Postby DonotTouchMyNotes » Wed Oct 16, 2024 7:31 am

I got the same problem,and the reason cause this,is when i config spi gpio set a wrong io,which had be used.Maybe you can check any part of your code that is configured.

Who is online

Users browsing this forum: No registered users and 227 guests