Skip to content

UART0 Slow Baud Reset Issue on Arduino ESP32 | Update : Suggests reset issue while writing Core register dump for CPU 1 at UART0 Baud < 6207 #7092

@gracengeer

Description

@gracengeer

Board

ESP32 Dev Module

Device Description

None

Hardware Configuration

None

Version

v2.0.4

IDE Name

Arduino IDE, esp-idf on Visual Studio Code

Operating System

Windows 11

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

921600

Description

ESP32 UART0 freezing and stuck at low baud rate and is unable to recover on WDT reset for exception errors

I am working on an ESP32 application which requires use of all three UARTs at low baud rate with UART0 baud rate strictly needed to be 4800 due to master IC specification.

To summarize, the behavior looks like following,

Arduino version for ESP32 : v1.0.4 with underlying esp-idf : v3.2.3 for Case 1 and Case 2
esp-idf : v3.2 for Case 3

Chip: ESP32- WROOM-32D
Flash : 16M (3M App + 9M FATFs)
Flash baud : 921600
CPU Freq : 240 MHz
Flash Freq : 80 MHz
Flash Mode : DIO
Debug Level : Info/Debug

Same behavior has been observed with latest Arduino version for ESP32 with esp-idf : v4.4.2 so it looks like have not been reported/fixed yet.

Case 1 : Arduino code on Arduino IDE : 4800 baud on UART0, ESP32 freezes and unable to undergo soft reset with partial output on Core 0 dump debug
Case 2 : idf code on Arduino IDE : 4800 baud on UART0, ESP32 freezes and unable to undergo soft reset with partial output on Core 0 dump debug
Case 3 : idf code on esp-idf : 4800 baud on UART0, ESP32 can undergo soft reset with full output on Core 0 dump debug

On further debugging, I found that the cut-off baud rate on UART0 to be 6207, below which the ESP32 freezes for any of the exception errors and is unable to reset. So it looks like very specific to the baud rate that is set

Sketch

############################
idf code running in Arduino IDE and idf platorm
############################

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_log.h"
#include "driver/uart.h"
#include "string.h"
#include "driver/gpio.h"


static const int RX_BUF_SIZE = 1024;

void setup() 
{
    const uart_config_t uart_config0 = {
        .baud_rate = 4800,
        .data_bits = UART_DATA_8_BITS,
        .parity = UART_PARITY_DISABLE,
        .stop_bits = UART_STOP_BITS_1,
        .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
        //.source_clk = UART_SCLK_APB, 
    };


    uart_driver_install(UART_NUM_0, RX_BUF_SIZE * 2, 0, 0, NULL, 0);
    uart_param_config(UART_NUM_0, &uart_config0);
    uart_set_pin(UART_NUM_0, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);

}

void loop() 
{
    const float value= 1000/0;
    ESP_LOGI("None", "Read value : %f ", value);
}

############################
Arduino code in Arduino IDE:
############################
void setup() 
{
     Serial.begin(4800);     
}

void loop() 
{
    float value= 1000/0;
    Serial.println(value);
    delay(1);
}

Debug Message

==================================================
UART0 @ 9600 baud Arduino code in Arduino - Core Debug Level : Info
==================================================
---------------------------
Serial out @ 9600 baud
---------------------------
Ԋ�Θ⸮�)1Q1⸮�⸮⸮⸮)⸮!⸮1A⸮Guru Meditation Error: Core  1 panic'ed (IntegerDivideByZero). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d0c18  PS      : 0x00060f30  A0      : 0x800d1f0c  A1      : 0x3ffb1f90  
A2      : 0x00000000  A3      : 0x3ffb0060  A4      : 0x00000020  A5      : 0x80000020  
A6      : 0x00000008  A7      : 0x00000001  A8      : 0x000003e8  A9      : 0x3ffb1f40  
A10     : 0x00000000  A11     : 0x00002580  A12     : 0x0800001c  A13     : 0x00000003  
A14     : 0x00000001  A15     : 0x00000000  SAR     : 0x0000001f  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  

Backtrace: 0x400d0c18:0x3ffb1f90 0x400d1f09:0x3ffb1fb0 0x40088215:0x3ffb1fd0

Rebooting...

---------------------------
Serial out @ 115200 baud
---------------------------
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (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:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac

rst:0xc (SW_CPU_RESET),boot:0x17 (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:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac

rst:0xc (SW_CPU_RESET),boot:0x17 (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:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac


==================================================
UART0 @ 4800 baud Arduino code in Arduino - Core Debug Level : Info
==================================================
---------------------------
Serial out @ 4800 baud
---------------------------
*T4⸮⸮٥Guru Meditation Error: Core  1 panic'ed (IntegerDivideByZero). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d0c18  PS      : 0x00060d30  A0      : 0x800d1f0c  A1      : 0x3ffb1f90  
A2      : 0x00000000  A3      : 0x3ffb0060  A4      : 0x00000020  A5      : 0x80000020  
A6      : 0x00000008  A7      : 0x00000001  A8      : 0x000003e8  A9      : 0x3ffb1f40  
A10     : 0x00000000  A11     : 0x000012c0  A12     : 0x0800001c  A13     : 0x00000003  
A14 
(Frozen with partial serial output)
---------------------------
Serial out @ 115200 baud
---------------------------
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (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:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
(Frozen here)

Other Steps to Reproduce

None

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions