ESP32CAM issue (Firebase + Hardware Serial problem)

Hi everyone, im making a code for ESP32CAM that recieves information from an arduino uno vía serial, im using the Rx/Tx ports of the ESP to program and display the info in the serial monitor, so i needed other pins to recibe and transmit information from/to an arduino, i used HardwareSerial to make pins 14 and 16 of ESP32CAM an extra pair of communication pins and it worked. Then i needed to connect firebase realtime database to the ESP32CAM, and i use a code that worked well without the hardwareserial, but when i try to use both the system starts rebooting (i imagine that is because a memory transgression, but i dont know). This is the code in the ESP32CAM, arduino send information of temperature and humidity in order. So, again , both codes work well alone, but together starts rebooting, what can i do?

#include <HardwareSerial.h>
#include <String.h>

#include <common.h>
#include <Firebase.h>
#include <FirebaseESP32.h>
#include <FirebaseFS.h>
#include <Utils.h>
#include <WiFi.h>

#define RXD2 16
#define TXD2 14

#define WIFI_SSID "MYWIFI"
#define WIFI_PASSWORD "MYPASSWORD"
#define FIREBASE_HOST  "MYHOST"
#define FIREBASE_APIKEY  "MYAPIKEY"

FirebaseData firebaseData;

HardwareSerial Serialinterno ( 1 );
String FromSerial;

void ToFirebase(String Path, String Value);

void setup() {
  Serial.begin(115200);
  Serialinterno.begin(9600,SERIAL_8N1,RXD2,TXD2); 
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("Conectando a ....");
  while (WiFi.status() != WL_CONNECTED)
  {
    Serial.print(".");
    delay(300);
  }
  Serial.println();
  Serial.print("Conectado con la IP: ");
  Serial.println(WiFi.localIP());
  Serial.println();

  Firebase.begin(FIREBASE_HOST, FIREBASE_APIKEY);
  Firebase.reconnectWiFi(true);
}
void loop() {
  while (Serialinterno.available() > 0) {
         FromSerial= Serialinterno.readStringUntil('\n');
         FromSerial.trim();
         if(FromSerial=="Temperature"){
          String Temp = Serialinterno.readStringUntil('\n');
          Temp.trim();
          Serial.println("Temperatura: "+Temp);
          ToFirebase("/Temp",Temp.toInt());
          }
         if(FromSerial=="Humidity"){
          String Hum = Serialinterno.readStringUntil('\n');
          Hum.trim();
          Serial.println("Humedad: "+Hum);
          ToFirebase("/Hum",Hum.toInt());
          }
    }
}
void ToFirebase(String Path, int Value){
  if(Firebase.ready()){
    Firebase.setInt(firebaseData,Path,Value);
    }
  }

The error is this:

rst:0x1 (POWERON_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:13132
load:0x40080400,len:3036
entry 0x400805e4
Conectando a ........
Conectado con la IP: (MY IP)

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

Core 1 register dump:
PC : 0x40092399 PS : 0x00060d30 A0 : 0x80092c26 A1 : 0x3ffb2670
A2 : 0xffffffff A3 : 0xffffffff A4 : 0x3ffb27dc A5 : 0x3ffcd628
A6 : 0x00000033 A7 : 0x3ffcd5f0 A8 : 0x00000010 A9 : 0x00000000
A10 : 0x0000000f A11 : 0x00000040 A12 : 0x00000000 A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000015 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000013 LBEG : 0x4008b969 LEND : 0x4008b979 LCOUNT : 0xfffffff2

Backtrace:0x40092396:0x3ffb26700x40092c23:0x3ffb2690 0x40092ea4:0x3ffb26b0 0x40083c02:0x3ffb26d0 0x40083c15:0x3ffb2700 0x400e735d:0x3ffb2720 0x400d270a:0x3ffb2740 0x400d273a:0x3ffb2760 0x400d298e:0x3ffb2780 0x400d2ad6:0x3ffb27a0 0x400e965a:0x3ffb2820

ELF file SHA256: 0000000000000000

Rebooting...

Ok, i pass the exception by a decoder and says this. i can see that is a memory problem, but what can i do? the sketch have free space, so is very strange.

/*
`PC: 0x40092399
 EXCVADDR: 0x00000013
 *Decoding stack results* 
0x40092396: **tlsf_malloc** at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/**heap_tlsf.c** line **441** 
0x40092c23: **multi_heap_malloc_impl** at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/**multi_heap.c** line **197** 
0x40092ea4: **multi_heap_malloc** at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/**multi_heap_poisoning.c** line **230** 
0x40083c02: **heap_caps_malloc_base** at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/**heap_caps.c** line **147** 
0x40083c15: **heap_caps_malloc** at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/**heap_caps.c** line **167** 
0x400e735d: **ps_malloc** at C:\Users\angel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32\**esp32-hal-psram.c** line **109**
 0x400d270a: **MB_String::allocate(unsigned int, bool)** at c:\users\angel\documents\arduino\libraries\firebase_esp32_client-3.12.10\src\json/**MB_String.h** line **1478** 
0x400d273a: **MB_String::_reserve(unsigned int, bool)** at c:\users\angel\documents\arduino\libraries\firebase_esp32_client-3.12.10\src\json/**MB_String.h** line **1518** 
0x400d298e: **FirebaseESP32::pre_begin(String, String)** at c:\users\angel\documents\arduino\libraries\firebase_esp32_client-3.12.10\src\json/**MB_String.h** line **1499**
 0x400d2ad6: **setup()** at C:\Users\angel\Documents\Arduino\libraries\Firebase_ESP32_Client-3.12.10\src/**Firebase.h** line **414**
 0x400e965a: **loopTask(void*)** at C:\Users\angel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32\**main.cpp** line **42**`

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.