Page 1 of 1

Exception output over USB with ESP32 S3?

Posted: Mon Oct 17, 2022 8:14 pm
by aaronw
Related to my previous open question about the ee.vld.128.ip instruction failing viewtopic.php?f=2&t=30121 instruction failing, how do I get the ESP32 S3 to dump out exception information over the USB interface? On the project I'm working on I would much prefer to not have to have a UART interface as well as USB due to size constraints. Is there a way to have exception information printed out the USB interface either instead of or along with the UART interface?

Re: Exception output over USB with ESP32 S3?

Posted: Mon Oct 17, 2022 9:26 pm
by ESP_igrr
The answer might depend on whether you are using IDF or Arduino.

In IDF, console output and panic handler messages are printed both to UART and USB_SERIAL_JTAG by default. You can change this in menuconfig if desired.

In Arduino the default Serial destination it is configured by one of the options in Tools menu.

Re: Exception output over USB with ESP32 S3?

Posted: Wed Oct 19, 2022 9:25 am
by aaronw
In my case, I am using the Arduino environment. There does not appear to be any setting that controls this there. I can see other print statements without any issues, only the exception information only appears to go to the UART interface.

Re: Exception output over USB with ESP32 S3?

Posted: Sun Dec 31, 2023 2:45 am
by nickolay
I was using an old version of ESP32 Arduino without realizing it. This manifested in missing backtrace info — Serial output and task watchdog messages displayed fine over USB-CDC.

Newer versions (esp32-arduino 2.0.7+ / esp-idf 4.4.4) print to USB serial by default (assuming you see any output at all). I tested with this sketch:

Code: Select all

void setup()
{
  Serial.begin(115200);
  Serial.println("Let's provoke the s/w wdt firing...");
  sleep(5);
  int *x = 0;
  *x = 5;

  Serial.println("This line will not ever print out");
}

void loop(){}
For the reference, the panic handler code is here, and esp32-arduino wraps it, but doesn't override.

Code: Select all

Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x42002a73  PS      : 0x00060830  A0      : 0x82003fa5  A1      : 0x3fcebd70
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00000000  A5      : 0x00000000
A6      : 0x3fcebf04  A7      : 0x80000001  A8      : 0x82002a70  A9      : 0x3fcebd50
A10     : 0x00000000  A11     : 0x00000004  A12     : 0x0007ffff  A13     : 0x80000000
A14     : 0x02c93da0  A15     : 0x00ffffff  SAR     : 0x00000010  EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0xffffffff