Hello. My ESP32 has an error and I am unsure as to why it is occuring. I keep getting this error:
Core 1 register dump:
PC : 0x40090dc4 PS : 0x00060f33 A0 : 0x80092adc A1 : 0x3ffb24f0
A2 : 0xae000000 A3 : 0xb33fffff A4 : 0x0000cdcd A5 : 0x00060f23
A6 : 0x00060f20 A7 : 0x0000abab A8 : 0x0000abab A9 : 0xffffffff
A10 : 0x00000000 A11 : 0x3ffc2fe8 A12 : 0x3ffb2708 A13 : 0x3ffc359c
A14 : 0x6e800000 A15 : 0x003fffff SAR : 0x00000018 EXCCAUSE: 0x0000001d
EXCVADDR: 0xae000000 LBEG : 0x4008aaa0 LEND : 0x4008aabc LCOUNT : 0xffffffff
Backtrace:0x40090dc1:0x3ffb24f00x40092ad9:0x3ffb2530 0x40092d7b:0x3ffb2550 0x40083c5d:0x3ffb2570 0x4009317d:0x3ffb2590 0x400d273b:0x3ffb25b0 0x400d27d5:0x3ffb25d0 0x400e04ce:0x3ffb25f0 0x400e0ad6:0x3ffb2660 0x400e0c9e:0x3ffb26c0 0x400d30fa:0x3ffb2770 0x400e5f5a:0x3ffb2820
ELF file SHA256: 0000000000000000
This is my code:
#include "WiFi.h"
#include "Arduino.h"
#include "soc/soc.h" // Disable brownout problems
#include "soc/rtc_cntl_reg.h" // Disable brownout problems
#include "driver/rtc_io.h"
#include <SPIFFS.h>
#include <FS.h>
#include <Firebase_ESP_Client.h>
//Provide the token generation process info.
#include <addons/TokenHelper.h>
#include <TinyGPSPlus.h>
#include "HardwareSerial.h"
TinyGPSPlus gps;
HardwareSerial SerialGPS(1);
//Replace with your network credentials
const char* ssid = "XXXXXXXXXXXXXXXXXXXXXX";
const char* password = "XXXXXXXXXXXXXXXXXXXXXX";
// Insert Firebase project API Key
#define API_KEY "XXXXXXXXXXXXXXXXX"
// Insert Authorized Email and Corresponding Password
#define USER_EMAIL "XXXXXXXXXXXXXXXXXXXXXXXXX"
#define USER_PASSWORD "XXXXXXXXXXXXXXXXXXXXXXXXXX"
// Insert Firebase storage bucket ID e.g bucket-name.appspot.com
#define STORAGE_BUCKET_ID "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
// Photo File Name to save in SPIFFS
#define FILE_TXT "/data/coords.txt"
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig configF;
bool taskCompleted = false;
void initWiFi(){
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
}
void initSPIFFS(){
if (!SPIFFS.begin(true)) {
ESP.restart();
}
else {
delay(500);
}
}
void setup(){
Serial.begin(115200);
initWiFi();
initSPIFFS();
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
//Firebase
// Assign the api key
configF.api_key = API_KEY;
//Assign the user sign in credentials
auth.user.email = USER_EMAIL;
auth.user.password = USER_PASSWORD;
//Assign the callback function for the long running token generation task
configF.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h
Firebase.begin(&configF, &auth);
Firebase.reconnectWiFi(true);
SerialGPS.begin(9600, SERIAL_8N1, 16, 12);
if (!SPIFFS.begin(true)){
Serial.println("An Error has occurred while mounting SPIFFS");
return;
}
while (SerialGPS.available() >0) {
gps.encode(SerialGPS.read());
}
Serial.print("LAT="); Serial.println(gps.location.lat(), 6);
Serial.print("LONG="); Serial.println(gps.location.lng(), 6);
Serial.print("ALT="); Serial.println(gps.altitude.meters());
File fileToWrite = SPIFFS.open(FILE_TXT, FILE_WRITE); //--------- Write to file
if (!fileToWrite){
Serial.println("Error opening");
return;
}
if (fileToWrite.print("test")){
Serial.println("Written");
}
else{
Serial.println("Write failed");
}
fileToWrite.close();
}
void loop() {
delay(1);
if (Firebase.ready() && !taskCompleted){
taskCompleted = true;
//MIME type should be valid to avoid the download problem.
//The file systems for flash and SD/SDMMC can be changed in FirebaseFS.h.
if (Firebase.Storage.upload(&fbdo, STORAGE_BUCKET_ID /* Firebase Storage bucket id */, FILE_TXT /* path to local file */, mem_storage_type_flash /* memory storage type, mem_storage_type_flash and mem_storage_type_sd */, FILE_TXT /* path of remote file stored in the bucket */, "data/txt" /* mime type */)){
Serial.printf("\nDownload URL: %s\n", fbdo.downloadURL().c_str());
}
else{
Serial.println(fbdo.errorReason());
}
}
}
The point of my code is to access the GPS and upload the data as a .txt file to a database.
Best - kripat