Please help: Unexpected reboot only with "PRO CPU has been reset by WDT" warning
Posted: 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
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);
}