Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled

SamuelCruz72
Posts: 1
Joined: Tue Feb 11, 2025 4:26 am

Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled

Postby SamuelCruz72 » Tue Feb 11, 2025 4:45 am

Hi everyone, I am developing a program in which I want to measure the flow in two YF S201 sensors and send the data to a MQTT broker, then I used interrupts to define a mesurement period, that technic worked when I just mesured the flow, but when I implemented the connection to MQTT broker and I uploaded the code into the board, the serial monitor began to show this error:

Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x4008a0a5 PS : 0x00060f30 A0 : 0x800d697c A1 : 0x3ffb21c0
A2 : 0x1b6bbc44 A3 : 0x1b6bbc40 A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000000 A9 : 0x3ffb2170
A10 : 0x00000000 A11 : 0x3ffc5f8c A12 : 0x00000002 A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000017 EXCCAUSE: 0x0000001c
EXCVADDR: 0x1b6bbc44 LBEG : 0x4008a0a5 LEND : 0x4008a0b5 LCOUNT : 0xffffffff

Backtrace: 0x4008a0a2:0x3ffb21c0 0x400d6979:0x3ffb21d0 0x400d69d9:0x3ffb21f0 0x400d33ed:0x3ffb2210 0x400d3427:0x3ffb2240 0x400d8592:0x3ffb2290

ELF file SHA256: 1d921d1eaeececc8

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (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:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4

I searched in some forums about this error and the most popular solution was to change the I/O ports, but I tried it and it didn't work, then I wanted to know if maybe my ESP i broken or I just have an error on my code. Here is the code I'm using if you wat to inspect it:

```C++
#include "definitions.h"
#include "PubSubClient.h"
#include <WiFi.h>

WiFiClient espClient;
PubSubClient client(espClient);

// WiFi functions
void connectWifiTask();

// MQTT functions
void publishMessage(const char*, String);
void callback(char*, byte*, unsigned int);
void reconnect();
void MedirCaudal();

void setup() {
Serial.begin(115200);
connectWifiTask();
client.setServer(mqtt_server, mqtt_port);
client.setCallback(callback);
pinMode(SENSOR_FLUJO_1, INPUT_PULLDOWN);
pinMode(SENSOR_FLUJO_2, INPUT_PULLDOWN);
pinMode(ELECTROVALVULA_1, OUTPUT);
pinMode(ELECTROVALVULA_2, OUTPUT);
attachInterrupt(SENSOR_FLUJO_1, ContarPulsos1, RISING); //(Interrupcion 0(#Pin,funcion,Flanco de subida))
attachInterrupt(SENSOR_FLUJO_2, ContarPulsos2, RISING);
}

void loop() {
if (!client.connected()){
reconnect();
}
MedirCaudal();
client.loop();
}

void MedirCaudal(){
float frecuencia[2];
ObtenerFrecuencias(frecuencia);
float caudal1_L_m = frecuencia[0]/factor_conversion;
float caudal2_L_m = frecuencia[1]/factor_conversion;
publishMessage(sensor1_topic, String(caudal1_L_m));
Serial.println("\nCaudal 1: " + String(caudal1_L_m));
publishMessage(sensor2_topic, String(caudal2_L_m));
Serial.println("\nCaudal 2: " + String(caudal2_L_m));
}

void connectWifiTask(){
Serial.print("\nConectando a: ");
Serial.println(WIFI_SSID);
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while(WiFi.status() != WL_CONNECTED){
delay(500);
Serial.print(".");
}
Serial.println("\nConectado al WiFi: ");
Serial.println("\nIP WiFi: " + WiFi.localIP());
}

void reconnect() {
while (!client.connected()) {
Serial.println("Intentando conexión MQTT");
String clientId = "ESP32Client";
clientId += String(random(0xffff), HEX);
if (client.connect(clientId.c_str(), mqtt_username, mqtt_password)) {
Serial.println("Conectado");
client.subscribe(command1_topic);
}else {
Serial.print("Comunicación fallida, rc= ");
Serial.println(client.state());
Serial.println("Intente de nuevo en 5 segundos");
delay(5000);
}
}
}

void callback(char* topic, byte* payload, unsigned int length) {
String incommingMessage = "";
for (int i = 0; i < length; i++) incommingMessage+=(char)payload;
Serial.println("Mensaje recibido [" + String(topic) + "]" + incommingMessage);
/*// check for other commands
else if( strcmp(topic,command2_topic) == 0){
if (incommingMessage.equals(“1”)) { } // do something else
}
*/

}

void publishMessage(const char* topic, String payload){
if (client.publish(topic, payload.c_str(), true))
Serial.println("Mensaje publicado [" + String(topic) + "]: "+payload);
}
```

ESP_Sprite
Posts: 9985
Joined: Thu Nov 26, 2015 4:08 am

Re: Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled

Postby ESP_Sprite » Tue Feb 11, 2025 7:27 am

Can you decode that backtrace?

RandomInternetGuy
Posts: 59
Joined: Fri Aug 11, 2023 4:56 am

Re: Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled

Postby RandomInternetGuy » Wed Feb 26, 2025 8:07 am

Leading you yet closer to the water, Register Dump & Backgrace has the needed info about Monitor decoding, but all of https://docs.espressif.com/projects/esp ... rrors.html is a pretty good read in your boat, particularly the secction about that bery error.

Who is online

Users browsing this forum: HaydosR and 70 guests