ESP32 Metro Core Panic

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jtgartner
 
Posts: 57
Joined: Mon Mar 27, 2017 8:09 pm

ESP32 Metro Core Panic

Post by jtgartner »

I’m experimenting with error handling on an ESP32. I have an ESP32 Feather and an ESP32 Metro.

I purposely cause a divide by zero error. On the Feather, I see a core panic error message on the monitor and the device reboots, which is expected; however, on the Metro I do not get a core panic message and I’m not sure if the device reboots or not (the neo pixel blinks for a second so, so maybe).

Also, just to clarify, I’m not expecting to catch blocks to catch the error. I’m just looking for the core panic message.

In both cases, they are running the exact same code.

I have checked CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT in the sdkconfig file, and it is correctly set.

For what it’s worth, I’ve attached a copy of the test code.

Any thoughts would be appreciated.

Thanks,
Jack

Code: Select all

using namespace std;
 
#include <Arduino.h>
#include <exception>
#include <stdexcept>

////#define CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT 1

void setup()
{
    Serial.begin(115200);
    // while (!Serial)
    // {
    //      delay(10);
    // }
    delay(2000);  
    Serial.println("\nESP32 Try-Catch Test\n");
    Serial.flush();


    delay(1000);

    int x = 123;
    int y = 0;
    try
    {
        Serial.println("At Test");
        Serial.print(x/y);                      // Force an error
        //throw(99);                             // Caught in int
        //throw("Oops...");                   // Caught in catch-all 
        //throw runtime_error ("Oops RT");    // Caught in RT 
    }

    catch(const std::runtime_error& e)
    {
        Serial.print("At runtime catch..."); Serial.println(e.what());
        while(1) {}
    }

    catch(int)
    {
        Serial.print("At int catch...");
        while(1) {}      
    }

    catch(const std::exception& e)
    {
        Serial.print("At exception catch..."); 
        Serial.println(e.what());
        while(1) {}
    }
    
    catch(...)
    {
        Serial.println("At catch-all...");
        while(1) {}
    }
}

void loop() 
{
    Serial.println("At Loop...");
    delay(500);
}


User avatar
jtgartner
 
Posts: 57
Joined: Mon Mar 27, 2017 8:09 pm

Re: ESP32 Metro Core Panic

Post by jtgartner »

Turns out that core panic messages are sent to the hardware UART debug port on the Metro. I connected a USB to TTL Serial Cable to the port and was able to see the messages.

Jack

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”