Skip to content

Getting abort() was called at PC 0x4201f923 on core 0 #9407

@Murugesh-Hobbyist

Description

@Murugesh-Hobbyist

Board

ESP32S3

Device Description

runs for 5 min correctly and reboots.

Hardware Configuration

5,6 - I2C,
10,11,12,13 - SPI,
17,18 - UART1,
7,8 - UART2

Version

latest master (checkout manually)

IDE Name

Arduino IDE

Operating System

Windows-11

Flash frequency

80

PSRAM enabled

yes

Upload speed

115200

Description

it works exactly as expected for around 5 minutes and restarts with a message.

Sketch

It is a split file voids were splitted. but the main program is here.

//------------------------------------------------------PenDrive-I2C-Communication----------------------------------------------------------------------

#include <Ch376msc.h>
#include <SoftwareSerial.h>
SoftwareSerial Pendrive(17,18); // RX, TX
Ch376msc flashDrive(Pendrive); 
char adatBuffer[255];
char adat[]="Vivamus nec nisl molestie, blandit diam vel, varius mi. Fusce luctus cursus sapien in vulputate.\n";
char adat2[] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis efficitur ac est eu pharetra. \n";

unsigned long totSect = 0;
unsigned long freeSect = 0;
byte percentg = 0;
byte tmpCommand; //used to store data coming from serial port
boolean readMore;
static char helpString[]= {"h:Print this help\n\n1:Create\n2:Append\n3:Read\n4:Read date/time\n"
            "5:Modify date/time\n6:Delete\n7:List dir\n8:Print free space"
            "\n9:Open/Create folder(s)/subfolder(s)"};
void printInfo();

//------------------------------------------------------SD-SPI-Communication----------------------------------------------------------------------

#include "FS.h"
#include "SD.h"
#include "SPI.h"

/* Hardware SP
MOSI: 11
MISO: 13
SCK: 12
SS: 10
*/

float count = 0.067;
#define B1 14
#define B2 15
#define LEDx 16

//------------------------------------------------------SD-SPI-Communication-Voids---------------------------------------------------------------

void listDir();
void createDir();
void removeDir();
void readFile();
void writeFile();
void appendFile();
void renameFile();
void deleteFile();
void testFileIO();
void SD_Button();

//----------------------------------------------------I2C-ADC-ADS1115-Communication-------------------------------------------------------------------------

#include <Wire.h>
#define SDA0_Pin 5
#define SCL0_Pin 6

#include <Adafruit_ADS1X15.h>
Adafruit_ADS1115 ADS1;  
Adafruit_ADS1115 ADS2;

//----------------------------------------------------I2C-RTC-DS1307------------------------------------------------------------------------

#include "RTCDS1307.h"
#include <Wire.h>
#define SDA0_Pin 5
#define SCL0_Pin 6
RTCDS1307 rtc(0x68);

uint8_t year, month, weekday, day, hour, minute, second;
bool period = 0;

String m[12] = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
String w[7] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri","Sat"};
void Clock();

//------------------------------------------------UART-Dwin-Display-Serial-communication----------------------------------------------------------------

#define txPin 8
#define rxPin 7
HardwareSerial &dwinSerial = Serial2;

void FloatToHex();
void sendFloatNumber1();
void sendFloatNumber2();

//--------------------------------------------------------Dual_Core_Initialisation-------------------------------------------------------

int 
Core0_ADC_1, Core1_ADC_1, Mid_ADC_1,
Core0_ADC_2, Core1_ADC_2, Mid_ADC_2,
Core0_ADC_3, Core1_ADC_3, Mid_ADC_3,
Core0_ADC_4, Core1_ADC_4, Mid_ADC_4,
Core0_ADC_5, Core1_ADC_5, Mid_ADC_5,
Core0_ADC_6, Core1_ADC_6, Mid_ADC_6;																																					

//-------------------------------------------------Dual_Core_Locking----------------------------------------------------------------------
			   							 

//-------------------------------------------------------Overall_Initialisation------------------------------------------------------------------------------

//unsigned char Buffer[9];

byte ADC1_Off[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x00, 0x01, 0x01 };
byte ADC1_Green[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x00, 0x00, 0x01 };
byte ADC1_Red[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x00, 0x00, 0x02 };

byte ADC2_Off[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x10, 0x01, 0x01 };
byte ADC2_Green[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x10, 0x00, 0x01 };
byte ADC2_Red[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x10, 0x00, 0x02 };

byte ADC3_Off[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x20, 0x01, 0x01 };
byte ADC3_Green[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x20, 0x00, 0x01 };
byte ADC3_Red[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x20, 0x00, 0x02 };

byte ADC4_Off[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x30, 0x01, 0x01 };
byte ADC4_Green[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x30, 0x00, 0x01 };
byte ADC4_Red[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x30, 0x00, 0x02 };

byte ADC5_Off[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x40, 0x01, 0x01 };
byte ADC5_Green[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x40, 0x00, 0x01 };
byte ADC5_Red[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x40, 0x00, 0x02 };

byte ADC6_Off[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x50, 0x01, 0x01 };
byte ADC6_Green[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x50, 0x00, 0x01 };
byte ADC6_Red[] = { 0x5A, 0xA5, 0x05, 0x82, 0x53, 0x50, 0x00, 0x02 };

byte Tolerance_Write[] = { 0x5A, 0xA5, 0x08, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

unsigned char incomingData[100];
unsigned char textString[100];
char receivedFloatArray[50];
float receivedFloat;
int check = 1;
float Setval_ADC1=0, Setval_ADC2=0, Setval_ADC3=0, Setval_ADC4=0, Setval_ADC5=0, Setval_ADC6=0;
int Convert1, Convert2, Convert3, Convert4, Convert5, Convert6;
float Final_ADC1, Final_ADC2, Final_ADC3, Final_ADC4, Final_ADC5, Final_ADC6;
long ADCTimer;
bool isit = true;
float tolerance = 0;
String Collect="";


//-------------------------------------------------------------Setup-----------------------------------------------------------------------------


void setup() {

  Serial.begin(115200);
  Wire.begin(SDA0_Pin, SCL0_Pin);

//------------------------Clock-RTC--------------------------

    rtc.begin();
 // rtc.setMode(0);
 // rtc.setDate(24, 3, 22);
 // rtc.setTime(11, 32, 20);

//------------------------Pendrive--------------------------

  Pendrive.begin(9600);flashDrive.init();
  printInfo(helpString);


//------------------------Display---------------------------

  dwinSerial.begin(115200, SERIAL_8N1,rxPin, txPin);
  dwinSerial.setTimeout(10);
  while (!Serial) { delay(1); }


//------------------------ADC---------------------------


  Core0_ADC_1=0; Core0_ADC_2=0; Core0_ADC_3=0; 
  Core0_ADC_4=0; Core0_ADC_5=0; Core0_ADC_6=0;


//------------------------Core_Build-------------------------

  disableCore0WDT();
  disableCore1WDT();

//-----------------------Setup_SD_Button-------------------------

{  
  pinMode(B1, INPUT_PULLUP);
  pinMode(B2, INPUT_PULLUP);
  pinMode(LEDx, OUTPUT);
  
  while(!Serial) { delay (10); }

#ifdef REASSIGN_PINS
    SPI.begin(sck, miso, mosi, cs);
#endif
    if(!SD.begin()){
        Serial.println("Card Mount Failed");
        return;
    }
    uint8_t cardType = SD.cardType();

    if(cardType == CARD_NONE){
        Serial.println("No SD card attached");
        return;
    }

    Serial.print("SD Card Type: ");
    if(cardType == CARD_MMC){
        Serial.println("MMC");
    } else if(cardType == CARD_SD){
        Serial.println("SDSC");
    } else if(cardType == CARD_SDHC){
        Serial.println("SDHC");
    } else {
        Serial.println("UNKNOWN");
    }

    uint64_t cardSize = SD.cardSize() / (1024 * 1024);
    Serial.printf("SD Card Size: %lluMB\n", cardSize);
/*
    listDir(SD, "/", 0);
    createDir(SD, "/mydir");
    listDir(SD, "/", 0);
    removeDir(SD, "/mydir");
    listDir(SD, "/", 2);
    writeFile(SD, "/hello.txt", "Hello ");
    appendFile(SD, "/hello.txt", "World!\n");
    readFile(SD, "/hello.txt");
    deleteFile(SD, "/foo.txt");
    renameFile(SD, "/hello.txt", "/foo.txt");
    readFile(SD, "/foo.txt");
    testFileIO(SD, "/test.txt");
    Serial.printf("Total space: %lluMB\n", SD.totalBytes() / (1024 * 1024));
    Serial.printf("Used space: %lluMB\n", SD.usedBytes() / (1024 * 1024));
    */  

char cstr[16];
itoa(count, cstr, 10);

float FltValue = 1.34567890;
char ChValue[10];
  dtostrf(FltValue, 10, 0, ChValue);
//dtostrf(float, minimum width, precision, character array);


    writeFile(SD, "/hello.txt", cstr);
    appendFile(SD, "/hello.txt", "\n");
    writeFile(SD, "/hello.txt", ChValue);
    readFile(SD, "/hello.txt");
}


{   
  disableCore0WDT();
  disableCore1WDT();

//------------------------ADC_16Bit-------------------------

 // ADS.setGain(GAIN_ONE);  // ADS.setGain(); ADS.setGain(GAIN_SIXTEEN);

  if (!ADS1.begin(0x48)) {
    Serial.println("1Failed to initialize ADS.");
    while (1);
  }  
  if (!ADS2.begin(0x49)) {
    Serial.println("2Failed to initialize ADS.");
    while (1);
  }
  
  delay(500);

  Core1_ADC_1=0; Core1_ADC_2=0; Core1_ADC_3=0; Core1_ADC_4=0; Core1_ADC_5=0; Core1_ADC_6=0;// Core1_ADC_7=0; Core1_ADC_8=0;
}

}


void loop() {
  fetchText();
  readADC();
  delay(20);
 // SD_Button();

}

//-------------------------------------------------------------readADC-----------------------------------------------------------------------------

void readADC() {

 ADS1.begin(0x48);
  Core0_ADC_1 = ADS1.readADC_SingleEnded(0);
  Core0_ADC_2 = ADS1.readADC_SingleEnded(1);
  Core0_ADC_3 = ADS1.readADC_SingleEnded(2);
  Core0_ADC_4 = ADS1.readADC_SingleEnded(3);

 ADS2.begin(0x49);
 Core0_ADC_5 = ADS2.readADC_SingleEnded(0);
 Core0_ADC_6 = ADS2.readADC_SingleEnded(1);
 
  if (check == 0 && isit == true) {
    if (millis() - ADCTimer > 50) {
      Convert1 = Core0_ADC_1; Convert2 = Core0_ADC_2; Convert3 = Core0_ADC_3;
      Convert4 = Core0_ADC_4; Convert5 = Core0_ADC_5; Convert6 = Core0_ADC_6;

      Serial.print(" Convert1 Reading->  ");Serial.print(Convert1);
      Serial.print(" set valout before ->  ");Serial.println(Setval_ADC1);
      Serial.println("-------------------------------------------------------"); 
      Serial.print(" convert1 before ->  ");Serial.println(Convert1);

      Final_ADC1 = map(Convert1, 20, 17654, 1105, 0);
      Final_ADC1 = (Final_ADC1 / 100);
      Setval_ADC1 = Final_ADC1;

      Final_ADC2 = map(Convert2, 20, 17654, 1105, 0);
      Final_ADC2 = (Final_ADC2 / 100);
      Setval_ADC2 = Final_ADC2;

      Final_ADC3 = map(Convert3, 20, 17654, 1105, 0);
      Final_ADC3 = (Final_ADC3 / 100);
      Setval_ADC3 = Final_ADC3;

      Final_ADC4 = map(Convert4, 20, 17654, 1105, 0);
      Final_ADC4 = (Final_ADC4 / 100);
      Setval_ADC4 = Final_ADC4;

      Final_ADC5 = map(Convert5, 20, 17654, 1105, 0);
      Final_ADC5 = (Final_ADC5 / 100);
      Setval_ADC5 = Final_ADC5;

      Final_ADC6 = map(Convert6, 20, 17654, 1105, 0);
      Final_ADC6 = (Final_ADC6 / 100);
      Setval_ADC6 = Final_ADC6;
   
      ADCTimer = millis();
      check = 1;
    }
  }

  if (millis() - ADCTimer > 50) {

      Convert1 = Core0_ADC_1; Convert2 = Core0_ADC_2; Convert3 = Core0_ADC_3;
      Convert4 = Core0_ADC_4; Convert5 = Core0_ADC_5; Convert6 = Core0_ADC_6;

      Final_ADC1 = map(Convert1, 20, 17654, 1105, 0);
      Final_ADC1 = (Final_ADC1 / 100) - Setval_ADC1;
      Final_ADC2 = map(Convert2, 20, 17654, 1105, 0);
      Final_ADC2 = (Final_ADC2 / 100) - Setval_ADC2;
      Final_ADC3 = map(Convert3, 20, 17654, 1105, 0);
      Final_ADC3 = (Final_ADC3 / 100) - Setval_ADC3;
      Final_ADC4 = map(Convert4, 20, 17654, 1105, 0);
      Final_ADC4 = (Final_ADC4 / 100) - Setval_ADC4;
      Final_ADC5 = map(Convert5, 20, 17654, 1105, 0);
      Final_ADC5 = (Final_ADC5 / 100) - Setval_ADC5;
      Final_ADC6 = map(Convert6, 20, 17654, 1105, 0);
      Final_ADC6 = (Final_ADC6 / 100) - Setval_ADC6;

  //  Serial.println(tolerance);

    if (tolerance > 0 && tolerance < 10 ) {

//-----------------------------Display_Signal_ADC1-----------------------------

      if (tolerance / 2 > abs(Final_ADC1) && tolerance / 2 != abs(Final_ADC1)) {
        Serial.println("ookkk");
        dwinSerial.write(ADC1_Green, sizeof(ADC1_Green));
      }
      if (tolerance / 2 <= abs(Final_ADC1)) {
        Serial.println("Nooooooooooooooooooo");
        dwinSerial.write(ADC1_Red, sizeof(ADC1_Red));
      }

//-----------------------------Display_Signal_ADC2-----------------------------

      
      if (tolerance / 2 > abs(Final_ADC2) && tolerance / 2 != abs(Final_ADC2)) {
        Serial.println("ookkk");
        dwinSerial.write(ADC2_Green, sizeof(ADC2_Green));
      }
      if (tolerance / 2 <= abs(Final_ADC2)) {
        Serial.println("Nooooooooooooooooooo");
        dwinSerial.write(ADC2_Red, sizeof(ADC2_Red));
      }

//-----------------------------Display_Signal_ADC3-----------------------------

      if (tolerance / 2 > abs(Final_ADC3) && tolerance / 2 != abs(Final_ADC3)) {
        Serial.println("ookkk");
        dwinSerial.write(ADC3_Green, sizeof(ADC3_Green));
      }
      if (tolerance / 2 <= abs(Final_ADC1)) {
        Serial.println("Nooooooooooooooooooo");
        dwinSerial.write(ADC3_Red, sizeof(ADC3_Red));
      }

//-----------------------------Display_Signal_ADC4-----------------------------

      if (tolerance / 2 > abs(Final_ADC4) && tolerance / 2 != abs(Final_ADC4)) {
        Serial.println("ookkk");
        dwinSerial.write(ADC4_Green, sizeof(ADC4_Green));
      }
      if (tolerance / 2 <= abs(Final_ADC4)) {
        Serial.println("Nooooooooooooooooooo");
        dwinSerial.write(ADC4_Red, sizeof(ADC4_Red));
      }

//-----------------------------Display_Signal_ADC5-----------------------------

      if (tolerance / 2 > abs(Final_ADC5) && tolerance / 2 != abs(Final_ADC5)) {
        Serial.println("ookkk");
        dwinSerial.write(ADC5_Green, sizeof(ADC5_Green));
      }
      if (tolerance / 2 <= abs(Final_ADC5)) {
        Serial.println("Nooooooooooooooooooo");
        dwinSerial.write(ADC5_Red, sizeof(ADC5_Red));
      }

//-----------------------------Display_Signal_ADC6-----------------------------

      if (tolerance / 2 > abs(Final_ADC6) && tolerance / 2 != abs(Final_ADC6)) {
        Serial.println("ookkk");
        dwinSerial.write(ADC6_Green, sizeof(ADC6_Green));
      }
      if (tolerance / 2 <= abs(Final_ADC6)) {
        Serial.println("Nooooooooooooooooooo");
        dwinSerial.write(ADC6_Red, sizeof(ADC6_Red));
      }

    }
    sendFloatTolerance(tolerance);
    sendFloatADC1(Final_ADC1); 
    sendFloatADC2(Final_ADC2); 
    sendFloatADC3(Final_ADC3); 
    sendFloatADC4(Final_ADC4); 
    sendFloatADC5(Final_ADC5); 
    sendFloatADC6(Final_ADC6); 
    ADCTimer = millis();
  }
 //delay(500);
}
//-------------------------------------------------------------fetchText-----------------------------------------------------------------------------


void fetchText() {
  if (dwinSerial.available() > 0) {
  Collect = dwinSerial.readString();
  receivedFloat = atof(Collect.c_str());
         dwinSerial.write(Tolerance_Write, sizeof(Tolerance_Write));
      if (receivedFloat == 0) { check = receivedFloat;  }
      if (receivedFloat > 0) { tolerance = receivedFloat; }
      Serial.print("Received float");
      Serial.println(receivedFloat, 2);
  }
  else{}
}

Debug Message

ESP Exception Decoder
Sketch: upgradingxxx_Single_Core FQBN: esp32:esp32:esp32s3


abort() was called at PC 0x4201f91b on core 0


Backtrace: 0x40377fb2:0x3fcebd00 0x4037b435:0x3fcebd20 0x40380c91:0x3fcebd40 0x4201f91b:0x3fcebdc0 0x4201f962:0x3fcebde0 0x4201f56d:0x3fcebe00 0x4201f3a4:0x3fcebe20 0x42006225:0x3fcebe40 0x420029a3:0x3fcebe60 0x42002f42:0x3fcebe90 0x420096c5:0x3fcebeb0




ELF file SHA256: d8317379328ebdb8

Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x2b (SPI_FAST_FLASH_BOOT)
Saved PC:0x40377bc0
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a80
entry 0x403c98d0


PC: 0x40377bc0: esp_restart_noos at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/port/soc/esp32s3\system_internal.c:151

Decoding stack results
0x40377fb2: panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system\panic.c:408
0x4037b435: esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system\esp_system.c:137
0x40380c91: abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib\abort.c:46
0x4201f91b: __cxxabiv1::__terminate(void at *)()) (/builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32s3-elf/src/gcc/libstdc++-v3/libsupc++\eh_terminate.cc:47
0x4201f962: std::terminate() at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32s3-elf/src/gcc/libstdc++-v3/libsupc++\eh_terminate.cc:57
0x4201f56d: __cxxabiv1::__cxa_allocate_exception(std::size_t) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32s3-elf/src/gcc/libstdc++-v3/libsupc++\eh_alloc.cc:300
0x4201f3a4:  is in operator new(unsigned int) (/builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32s3-elf/src/gcc/libstdc++-v3/libsupc++/new_op.cc:54).
0x42006225:  is in Adafruit_ADS1X15::begin(unsigned char, TwoWire*) (c:\Users\murug\OneDrive\Documents\Arduino\libraries\Adafruit_ADS1X15\Adafruit_ADS1X15.cpp:66).
0x420029a3: readADC() at H:\Personal\Industry_Automation\dualx\upgradingxxx_Single_Core\upgradingxxx_Single_Core.ino:296
0x42002f42: loop() at H:\Personal\Industry_Automation\dualx\upgradingxxx_Single_Core\upgradingxxx_Single_Core.ino:280
0x420096c5: loopTask(void*) at C:\Users\murug\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32\main.cpp:50

Paste exception to decode...

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions