Skip to content

[Application Failure - Bad Code] esp32c3 always rebooting #10085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
frrhhhann opened this issue Jul 29, 2024 · 13 comments
Closed
1 task done

[Application Failure - Bad Code] esp32c3 always rebooting #10085

frrhhhann opened this issue Jul 29, 2024 · 13 comments
Assignees
Labels
Status: Community help needed Issue need help from any member from the Community. Type: Question Only question

Comments

@frrhhhann
Copy link

Board

esp32c3

Device Description

i recently made digital dash for display car ecu data using xiao seed esp32c3, but the esp32 keep rebooting, the code i'm using is from this github https://github.com/73Volvo/Speedypal/tree/main but the original code is for xiao seed esp32s3 with 0.96 oled ssd1306, i custom the code for using xiao esp32c3 only delete led indicator because xiao esp32c3 don't have built in led, and change ssd1306 library to sh1106g. it works fine it can upload the code and display startup logo but it keep rebooting

Hardware Configuration

xiaoo esp32c3, D4 D5 for i2c connect to sh1106g 1.3 inch oled, D7 D6 for RX TX comunication to ecu

Version

latest master (checkout manually)

IDE Name

arduino ide

Operating System

windows 10

Flash frequency

160Mhz

PSRAM enabled

yes

Upload speed

115200

Description

i finished project but my xiao esp32c3 keep rebooting in serial monitor

Sketch

#include "Arduino.h"
#include "SpeedyPal.h"
#include "Wire.h"

// *****************************************************
// HERE ARE SOME VARIABLES YOU MIGHT WANT TO ADJUST
// *****************************************************

// Set to "true" record a binary MLG log. Set to "false" to record an ASCII MSL log
bool binaryLog = true;

// is there a second screen connected?
bool multiScreen = false;

// frames per second for sampling and display
uint8_t fps = 20;

// vehicle info
uint16_t flowRate = 329; // cc/min
uint8_t cyl = 6; // 4 cylinders
uint16_t weightKg = 1332; // weight in kg
float frontalArea = 1.749; // frontal area in square meters
float dragCoefficient =  0.41; // drag coefficient

// constants for arduino pins
const int8_t ButtonPinL = D1;  // the number of the left button pin
const int8_t ButtonPinR = D2;  // the number of the right button pin
const int8_t chipSelect = D3; // D3 for Seeed ESP32S3, 21 for Seeed Sense  // the number of Chip Select pin for the SD card
const int8_t TXpin = D6;  // the number of the TX pin
const int8_t RXpin = D7;  // the number of the RX pin

// *****************************************************
// HERE ARE SOME VARIABLES YOU PROBABLY WON'T ADJUST
// *****************************************************

// bool to detect if SD card is present
bool SD_PRESENT = false;

// screen variables
uint8_t SCREEN_ROTATION = 0; // 0 = 0° normal horizontal, 1 = 90° normal vertical, 2 = 180° flipped horizontal, 3 = 270° flipped vertical
uint8_t SCREEN_WIDTH = 128; // 128 for horizontal, 64 for vertical
uint8_t SCREEN_HEIGHT = 64; // 64 for horizontal, 128 for vertical

// extra unused variable for settings screen
uint8_t VAR1;

// Engine info, this will be overwritten when the program reads from SPIFFS, so just adjust it in the "Settings" screen
uint16_t SHIFTLIGHT_ON_RPM = 5500; // Activate shift light above this threshold

// these are used when adding markers to the log file (quick click with both buttons)
bool markerFlag = false; // flag that a button has been short-pressed to leave a marker in the log file.
long markerCounter = 0; // counter to make the "X" appear on screen for a bit of time.

// for settingsScreen navigation
bool settingsAdd = 0;
uint8_t settingsSelect = 0;

//time variables, these will be overwritten when the program reads from the RTC
uint8_t hour = 12;
uint8_t minute = 12;
uint8_t second = 12;
uint8_t day = 12;
String dayWeek; // such as "Friday"
uint8_t month = 12;
uint16_t year = 2023;

//global variables
uint8_t sweepFlag = 0; // are the gauges being swept?
int16_t clt; // coolant temp
int16_t cltSweep; // used for needle sweep
int16_t iat; // intake air temp
uint8_t bat; // battery voltage
float mph; // miles per hour
uint8_t smoothMPH = 8; // smoothing for MPH
float acceleration; // MPH per Second
uint8_t smoothPerf = 9; // smoothing for HP, Torque and Acceleration
float horsepower; // Horsey Power
float torque; // Torque Power
float timeTo30; // recording the zero-to-30 time
float timeTo60; // recording the zero-to-60 time
float mpg; // miles per gallon
uint8_t baro; // barometric pressure
uint8_t afr; // o2 Sensor Air Fuel Ratio Reading
uint8_t afrT; // AFR target
uint8_t adv; // Advance Degrees
uint16_t MAP; // Manifold Air Pressire
uint16_t pw; // Pulse Width
uint16_t rpm; // RPM
uint16_t rpmSweep; // used to tell if needle sweep is happening
uint16_t tpsdot; // Trottle Position Sensor DOT
uint8_t ve; // current VE
uint16_t tps; // throttle position sensor %
float null; // null float for stats that are ready from the Speeduino and so don't need to be connected to a calculated float

float currentFrameRate; // tracking the framerate of the arduino
uint8_t ecuWait = 5; // pause in ms we'll wait for ECU to respond
bool ecuConnected = false; // used when checking for ECU connection

// sampling rate for logging, calculated by the "fps" above
uint32_t interval;

uint32_t odometer; // There's an extra two digits for a tenths & hundreths. Divide by 100 before display.
float odometerFloat; // a float of the odometer is needed for the logging
float thousandthsCounter; // count hundreths of a mile to update odometer
float tripDistanceA;  // trip miles A covered
float tripDistanceB;  // trip miles B covered

// keeping track of trip gallons used
float tripGallonsUsedA = 0.0; 
float tripGallonsUsedB = 0.0;

//variable to calculate average MPG
uint32_t totalCountMPGa = 0;   // Total count of numbers
uint32_t sumMPGa = 1;          // Sum of numbers
uint16_t averageMPGa = 1;      // Average of numbers
uint32_t totalCountMPGb = 0;   // Total count of numbers
uint32_t sumMPGb = 1;          // Sum of numbers
uint16_t averageMPGb = 1;      // Average of numbers

//variable to calculate average MPH
uint32_t totalCountMPHa = 0;   // Total count of numbers
uint32_t sumMPHa = 1;          // Sum of numbers
uint16_t averageMPHa = 1;      // Average of numbers
uint32_t totalCountMPHb = 0;   // Total count of numbers
uint32_t sumMPHb = 1;          // Sum of numbers
uint16_t averageMPHb = 1;      // Average of numbers

// for custom screen
uint8_t customScreen = 0; // flag - is Custom Screen selected?
uint8_t customScreenSelect = 0; // which custom stat is currently shown?
bool customScreenSwitch = 0; // which screen, A or B, is selected?
uint8_t customScreenSelectA = 0; // which custom stat A is selected?
uint8_t customScreenSelectB = 0; // which custom stat B is selected?

uint8_t pageNum = 0; // currently displayed page
bool clockSetFlag = 0; // has the clock been adjusted by the user on the settings page?
bool settingsFlag = 0; // has a non-clock setting been adjusted by the user on the settings page?

void setup()
{
  pinMode(ButtonPinR, INPUT_PULLUP);
  pinMode(ButtonPinL, INPUT_PULLUP);

  Wire.begin();
  Serial.begin(115200); // usb connection on Arduino Nano
  Serial1.begin(115200, SERIAL_8N1, RX, TX); // serial connection to Speeduino. D7 and D6 on Seeed SAMD21, RX and TX on Seeed ESP32
  // Serial1.begin(115200); // for SAMD21
  Serial.println("serial started");
  initDisplay();

  // setup RTC
  setupClock();
  updateTimeVariables(); // grab time variables from RTC clock

  // setup SPIFFS
  setupSPIFFS();
  if (SPIFFSconnected()) readFromSPIFFS();

  Serial.println("checking for ECU");
  ecuConnected = requestData(50); // is the Speeduino connected? Waits 50ms for ECU to respond
  if(!ecuConnected) Serial.println("ECU not found");
  else Serial.println("ECU found");

  // setup SD card, count files on SD card
  SDsetup();
  // start SD log file
  if (binaryLog) SDstartLogBIN(); // start Binary log
    else SDstartLogASCII(); // start ASCII log
}

void loop()
{
  // set interval based on fps setting
  if (fps<10) fps = 10;
  interval = 1000/fps;

  // variables for governing consistent framerate
  static uint32_t previousMillisLog;
  static uint32_t nextTimeLog = millis() + interval;
  static uint32_t nextTimeTen = millis() + 10000;

  //*********************************************************************
  // Run this part in the preset interval (default is 10 times per second)
  //*********************************************************************

  if (millis() >= nextTimeLog) // only run this section if it's been at least the "interval" since the last loop
  {
    currentFrameRate = 1000.0 / (millis() - previousMillisLog); 
    // Serial.print("Current Frame Rate: ");
    // Serial.println(currentFrameRate);

    previousMillisLog = millis();
    // update next time
    nextTimeLog = (previousMillisLog + interval);

    updateTimeVariables(); // set time variables based off the RTC clock
    
    // is the Speeduino connected? Also, read the ECU's information into a buffer called "buffer"
    if (ecuWait < 5) ecuWait = 5; // don't wait less than 5ms for Speeduino to respond
    ecuConnected = requestData(ecuWait);

    // this reads a bunch of stats from the buffer and assigns them to variables like "map" and "baro"
    grabStats();

    // log the stats to the SD card
    if (binaryLog) SDlogBIN(); // add to log with Binary
      else SDlogASCII(); // add to log with ASCII

    // Record stats for the graphs
    recordGraph(mpg/10.0, 0, 10); // settings are:  (variable to record, graph number, graph speed from 1-10 higher is slower)
    recordGraph(averageMPGa/10.0, 1, 10);
    recordGraph(afr/10, 2, 1);
    recordGraph(afrT/10, 3, 1);

    if (millis() >= nextTimeTen) // Only run this stuff every ten seconds
    {
      // **************************************
      // This subroutine runs every 10 seconds)
      // **************************************
      nextTimeTen += 10000;
      if (SPIFFSconnected()) {
        writeToSPIFFS(); // save trip & settings info to SPIFFS
      }
      SDsync();
    }

    // *******************************************************************************
    // Back to the part that runs at the preset interval (default 10 times per second)
    // *******************************************************************************

    // sweep the tach if just starting the code. Runs after logging so it doesnt reflect in logs.
    tachSweep();

    setDisplay(1);

    //has the screen rotation been changed in the settings? If so, update it.
    updateRotation();

    startPage(); // Clears display

      switch(pageNum)   // this part decides what page is displayed in the horizontal view
      {
        case 0:
          // variables for gauge display
          int16_t CLTdisplay;
          uint16_t RPMdisplay;
          // are the gauges being swept?
          if (sweepFlag != 2) RPMdisplay = rpmSweep;
            else RPMdisplay = rpm;
          if (sweepFlag != 2) CLTdisplay = cltSweep;
            else CLTdisplay = clt;
          // three circle gauges
          // ( x position, y position, diameter, start angle, end angle, gradiations, stat value, start range, end range, redline, numbers switch )
          if (SCREEN_ROTATION == 0 || SCREEN_ROTATION == 2){
          // horizontal screen
          drawCircleGauge( 64, 64, 62 , 170, 10, 9, RPMdisplay, 0, 8000, 6500, 1);
          drawCircleGauge( 64, 64, 40 , 170, 10, 5, CLTdisplay, 125, 230, 212, 0);
          drawCircleGauge( 64, 64, 18 , 170, 10, 3, bat, 100, 160, 130, 0);
          }
          else {
          // vertical screen
          drawCircleGauge( 64, 64, 62 , 260, 100, 9, RPMdisplay, 0, 8000, 6500, 1);
          drawCircleGauge( 64, 64, 40 , 260, 100, 5, CLTdisplay, 125, 230, 212, 0);
          drawCircleGauge( 64, 64, 18 , 260, 100, 3, bat, 100, 160, 130, 0);
          }
          break;
        case 1:
          // date and time
          if (SCREEN_ROTATION == 0 || SCREEN_ROTATION == 2){
            drawAnalogClock(hour, minute, second, SCREEN_WIDTH/1.5, SCREEN_HEIGHT/2, SCREEN_HEIGHT-1);
            printFormattedDate(day, month, year, dayWeek, 21, 16);
          }
          else {
            drawAnalogClock(hour, minute, second, SCREEN_WIDTH/2, SCREEN_HEIGHT/4, SCREEN_WIDTH-1);
            printFormattedDate(day, month, year, dayWeek, 32 , (SCREEN_HEIGHT/2)+16);
          }
          break;
        case 2:
          twoStats(1, "WATER", clt, 0, 32, 212, "AIR", iat, 0, 32, 110);
          twoStats(2, "RPM", rpm, 0, 600, 6000, "MPGb", averageMPGb, 1, 0, 100);
          bottomRow("MPG", mpg , 1, 0, 100);
          break;
        case 3:
          // bar graphs
          // drawBarGraph(int row, int variable, int minVal, int maxVal, int redline, String label)
          drawSmallBarGraph(1, afr, 1, 11.7, 17.6, 14.7, "AFR");
          drawSmallBarGraph(2, afrT, 1, 11.7, 17.6, 14.7, "AFRt");
          drawBarGraph(2, MAP, 0, 0, 100, 50, "MAP");
          break;
        case 4:
          // fast AFR graph
          if (SCREEN_ROTATION == 0 || SCREEN_ROTATION == 2){
          // horizontal screen
          displayGraph(0, 2, 0, 20, "AFR" , afr, 1, 0, 20, "AFRt", afrT, 1, 0, 20);
          displayGraph2(0, 3, 0, 20); // second dotted line graph
          }
          else {
          // vertical screen
          displayGraph(0, 2, 0, 20, "AFR" , afr, 1, 0, 20, "0", 0, 0, 0, 0);
          displayGraph(1, 3, 0, 20, "AFRt", afrT, 1, 0, 20, "0", 0, 0, 0, 0);
          }
          break;
        case 5:
          // trip computer
          twoStats(1, "MPHa", averageMPHa, 0, -1, 100, "MPHb", averageMPHb, 0, -1, 100);
          twoStats(2, "MPGa", averageMPGa, 1, 0, 99, "MPGb", averageMPGb, 1, 0, 99);
          if (tripGallonsUsedA < 10 ) twoStats(3, "GALa", (tripGallonsUsedA*100.0), 2, -1, 9999, "0", 0, 0, 0, 0);
            else if (tripGallonsUsedA >= 10 && tripGallonsUsedA < 100) twoStats(3, "GALa", (tripGallonsUsedA*10.0), 1, -1, 9999, "0", 0, 0, 0, 0);
              else twoStats(3, "GALa", (tripGallonsUsedA), 0, -1, 9999, "0", 0, 0, 0, 0);
          if (tripGallonsUsedB < 10) twoStats(3, "0", 0, 0, 0, 0, "GALb", (tripGallonsUsedB*100.0), 2, -1, 9999);
            else if (tripGallonsUsedB >= 10 && tripGallonsUsedB < 100) twoStats(3, "0", 0, 0, 0, 0, "GALb", (tripGallonsUsedB*10.0), 1, -1, 9999);
              else twoStats(3, "0", 0, 0, 0, 0, "GALb", (tripGallonsUsedB), 0, -1, 9999);
          if (tripDistanceA < 10) twoStats(4, "TRPa", (tripDistanceA*100.0), 2, -1, 9999, "0", 0, 0, 0, 0);
            else if (tripDistanceA >= 10 && tripDistanceA < 100) twoStats(4, "TRPa", (tripDistanceA*10.0), 1, -1, 9999, "0", 0, 0, 0, 0);
              else twoStats(4, "TRPa", (tripDistanceA), 0, -1, 9999, "0", 0, 0, 0, 0);
          if (tripDistanceB < 10) twoStats(4, "0", 0, 0, 0, 0, "TRPb", (tripDistanceB*100.0), 2, -1, 9999);
            else if (tripDistanceB >= 10 && tripDistanceB < 100) twoStats(4, "0", 0, 0, 0, 0, "TRPb", (tripDistanceB*10.0), 1, -1, 9999);
              else twoStats(4, "0", 0, 0, 0, 0, "TRPb", (tripDistanceB), 0, -1, 9999);
          // twoStats(4, "0", 0, 0, 0, 0, "" , (odometer/100), 0 , 0, 999999); // full odometer
          break;
        case 6:
          // performance screen
          twoStats(1, "MPH", mph, 0, -200, 200, "0", 0, 0, 0, 0);
          twoStats(2, "TRQ", torque, 0, -1000, 1000 , "0", 0, 0, 0, 0);
          if (timeTo60 < 1000) twoStats(1, "0", 0, 0, 0, 0, "0-60", (timeTo60), 2, -1, 9999);
            else twoStats(1, "0", 0, 0, 0, 0, "0-60", (timeTo60/10), 1, -1, 9999);
          if (timeTo30 < 1000) twoStats(2, "0", 0, 0, 0, 0, "0-30", (timeTo30), 2, -1, 9999);
            else twoStats(2, "0", 0, 0, 0, 0, "0-30", (timeTo30/10), 1, -1, 9999);
          bottomRow("HP", horsepower , 0, -1000, 1000);
          break;
        case 7:
          twoStats(1, "WATER", clt, 0, 32, 212, "FPS", currentFrameRate, 0, 10, 100);
          twoStats(2, "TPS", tps, 1, -1, 100, "AFR" , afr, 1 , 0, 20);
          twoStats(3, "ADV", adv, 0, 0, 60, "AFRt", afrT, 1, 10, 20);
          twoStats(4, "MAP", MAP, 0, 0, 110, "PW", pw, 1, 0, 30);
          break;
        case 8:
          // settings Screen
          settingsPage();
          break;
        case 9:
          // simple customizable display page
          customGauge(customScreenSelect);
          break;
        default:
          break;
        }

    shiftLight(); // draw an inverse rectangle if the rpm is over the shift limit

    buttonCheck(); // Button operation and display button indicator overlays
    
    if (markerFlag) markerCounter = millis() + 250;
    if (millis() < markerCounter) markX(); // if marker is being added to the log, draw an "X" on the screen
    // Serial.println(markerFlag);

    errorPopUp(ecuConnected, SD_PRESENT); // display a notification if ECU or SD Card are not present

    endPage(); // writes the latest changes to the screen

    if (multiScreen){
        setDisplay(2);
          //has the screen rotation been changed in the settings? If so, update it.
          updateRotation();
          startPage(); // Clears display
            bool tempSwitch = customScreenSwitch;
            customScreenSwitch = 1;
            customGauge(customScreenSelectB);
            customScreenSwitch = tempSwitch;
            if(!ecuConnected) errorPopUp(ecuConnected, SD_PRESENT); // if Speeduino isn't connected, print the "no connection" page
          endPage();
    }

    // if a setting has been changed, save it to SPIFFS
    if (SPIFFSconnected() && settingsFlag == 1) {
      writeToSPIFFS();
      settingsFlag = 0;
    }

    // if clock has been set, reflect those changes in the RTC
    if (clockSetFlag == 1) {
      if ( RTCconnected() ) { // if the RTC is connected
        displayVariableTime(); // display time variables in Serial Monitor
        checkTimeVariables(); // make sure the time isn't set to impossible dates
        setTime(year, month, day, hour, minute, second);
        displayTime(); // display RTC clock in Serial Monitor
        Serial.println("RTC clock set");
      }
      clockSetFlag = 0;
    }
  }

}

Debug Message

20:47:37.342 -> Rebooting...
20:47:37.342 -> ESP-ROM:esp32c3-api1-20210207
20:47:37.342 -> Build:Feb  7 2021
20:47:37.342 -> rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
20:47:37.342 -> Saved PC:0x40381c52
20:47:37.342 -> SPIWP:0xee
20:47:37.342 -> mode:DIO, clock div:1
20:47:37.342 -> load:0x3fcd5810,len:0x438
20:47:37.342 -> load:0x403cc710,len:0x90c
20:47:37.342 -> load:0x403ce710,len:0x2624
20:47:37.342 -> entry 0x403cc710
20:47:40.604 -> Guru Meditation Error: Core  0 panic'ed (Load access fault). Exception was unhandled.
20:47:40.604 -> 
20:47:40.604 -> Core  0 register dump:
20:47:40.604 -> MEPC    : 0x42010698  RA      : 0x42010620  SP      : 0x3fc99d40  GP      : 0x3fc8c000  
20:47:40.604 -> TP      : 0x3fc869dc  T0      : 0x4005890e  T1      : 0x0000000f  T2      : 0x0000000e  
20:47:40.604 -> S0/FP   : 0x00000000  S1      : 0x3fc8de68  A0      : 0x3fc8de68  A1      : 0x00000020  
20:47:40.604 -> A2      : 0x00000000  A3      : 0x646e7553  A4      : 0x646e7553  A5      : 0x00000000  
20:47:40.604 -> A6      : 0x00000000  A7      : 0x00000003  S2      : 0x00000040  S3      : 0x00000020  
20:47:40.604 -> S4      : 0x00000000  S5      : 0x646e7553  S6      : 0x00000040  S7      : 0x00000001  
20:47:40.604 -> S8      : 0x00000000  S9      : 0x00000000  S10     : 0x00000008  S11     : 0x00000000  
20:47:40.604 -> T3      : 0x00000078  T4      : 0x00000001  T5      : 0x3fc99c50  T6      : 0x00000001  
20:47:40.604 -> MSTATUS : 0x00001881  MTVEC   : 0x40380001  MCAUSE  : 0x00000005  MTVAL   : 0x646e7553  
20:47:40.604 -> MHARTID : 0x00000000  
20:47:40.604 -> 
20:47:40.604 -> Stack memory:
20:47:40.604 -> 3fc99d40: 0x00000005 0x00000001 0x3fc8bc48 0x4201ba08 0x3fc9291a 0x00000011 0x3fc91000 0x3fc929d1
20:47:40.604 -> 3fc99d60: 0x00000000 0x00000000 0x00000000 0x3fc93000 0x00010001 0x3fc8b92c 0x3fc9291a 0x3c061000
20:47:40.604 -> 3fc99d80: 0x00000020 0x00000011 0x3fc92a10 0x4200e5a0 0x00000000 0x00000000 0x3fc9a358 0x3fc93000
20:47:40.604 -> 3fc99da0: 0x00000000 0x00000000 0x0008002a 0x44414f4c 0x00474e49 0x00000000 0x87c8bc28 0x1f9e2cbd
20:47:40.604 -> 3fc99dc0: 0x00000000 0x00000000 0x3fc91000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
20:47:40.604 -> 3fc99de0: 0x00000000 0x00000000 0x3fc91000 0x3fc9291a 0x08000000 0x3fc8e000 0x3fc92a10 0x4200e776
20:47:40.604 -> 3fc99e00: 0x00000000 0x00000000 0x00000000 0x00005000 0x08000000 0x0001c000 0x3fc91000 0x4200e828
20:47:40.604 -> 3fc99e20: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x3fc93000 0x42019000 0x4201c21e
20:47:40.604 -> 3fc99e40: 0x00000000 0x00000000 0x00000000 0x4038777e 0x00000000 0x00000000 0x00000000 0x00000000
20:47:40.604 -> 3fc99e60: 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
20:47:40.604 -> 3fc99e80: 0xbaad5678 0x00000160 0xabba1234 0x00000154 0x3fc99c90 0x00000af5 0x3fc91e7c 0x3fc91e7c
20:47:40.604 -> 3fc99ea0: 0x3fc99e90 0x3fc91e74 0x00000018 0x3fc9a2e8 0x3fc9a2e8 0x3fc99e90 0x00000000 0x00000001
20:47:40.604 -> 3fc99ec0: 0x3fc97e80 0x706f6f6c 0x6b736154 0x4ea13700 0x003777b4 0x00000000 0x3fc99e70 0x00000001
20:47:40.604 -> 3fc99ee0: 0x00000000 0x00000000 0x00000000 0x00000000 0x3fc93694 0x3fc936fc 0x3fc93764 0x00000000
20:47:40.604 -> 3fc99f00: 0x00000000 0x00000001 0x00000000 0x00000000 0x00000000 0x4203eb6e 0x00000000 0x00000000
20:47:40.604 -> 3fc99f20: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
20:47:40.604 -> 3fc99f40: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
20:47:40.604 -> 3fc99f60: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
20:47:40.604 -> 3fc99f80: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
20:47:40.604 -> 3fc99fa0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
20:47:40.604 -> 3fc99fc0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
20:47:40.604 -> 3fc99fe0: 0x4a000000 0xbaad5678 0x00000060 0xabba1234 0x00000054 0x00000000 0x3fc99ff4 0x00000000
20:47:40.604 -> 3fc9a000: 0x00000000 0x00000000 0x3fc9a00c 0xffffffff 0x3fc9a00c 0x3fc9a00c 0x00000000 0x3fc9a020
20:47:40.604 -> 3fc9a020: 0xffffffff 0x3fc9a020 0x3fc9a020 0x00000001 0x00000001 0x00000000 0x2000ffff 0x00000000
20:47:40.604 -> 3fc9a040: 0xb33fffff 0x00000000 0xbaad5678 0x0000008c 0xabba1234 0x00000080 0xff998ce1 0x6acd1a67
20:47:40.604 -> 3fc9a060: 0x5b84c8a1 0x235b4490 0x12260402 0x2550473b 0x7ebbb90a 0xfb91467c 0x29acf3bf 0xc0b7c92f
20:47:40.604 -> 3fc9a080: 0x6b2868c1 0x22a5f5c4 0x0015f514 0x929df6a8 0x1d03f66f 0x49ddc30f 0xba3f34c2 0x6e43b986
20:47:40.604 -> 3fc9a0a0: 0x50220bc2 0x6891f736 0x2c421a88 0x3093b434 0x6b0f6cfe 0xccfa77ca 0x9e8ba2b8 0xb6d75e1b
20:47:40.604 -> 3fc9a0c0: 0x020d284e 0xfaa74984 0x51e36c7c 0xd2422ed5 0x81e968b0 0x8bea17a9 0xbaad5678 0x0000008c
20:47:40.604 -> 3fc9a0e0: 0xabba1234 0x00000080 0x00000040 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
20:47:40.604 -> 3fc9a100: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
20:47:40.604 -> 3fc9a120: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x07000000 0x04040404

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.
@frrhhhann frrhhhann added the Status: Awaiting triage Issue is waiting for triage label Jul 29, 2024
@frrhhhann
Copy link
Author

custom code speedypal.zip
here is full code that i custom

@VojtechBartoska VojtechBartoska added the Type: Question Only question label Jul 29, 2024
@SuGlider
Copy link
Collaborator

SuGlider commented Jul 29, 2024

@frrhhhann - what are those pins:

// constants for arduino pins
const int8_t ButtonPinL = D1;  // the number of the left button pin
const int8_t ButtonPinR = D2;  // the number of the right button pin
const int8_t chipSelect = D3; // D3 for Seeed ESP32S3, 21 for Seeed Sense  // the number of Chip Select pin for the SD card
const int8_t TXpin = D6;  // the number of the TX pin
const int8_t RXpin = D7;  // the number of the RX pin

Those are not listed in https://github.com/espressif/arduino-esp32/blob/master/variants/esp32c3/pins_arduino.h

@SuGlider SuGlider added Status: Community help needed Issue need help from any member from the Community. and removed Status: Awaiting triage Issue is waiting for triage labels Jul 29, 2024
@SuGlider
Copy link
Collaborator

@frrhhhann - what are those pins:

// constants for arduino pins
const int8_t ButtonPinL = D1;  // the number of the left button pin
const int8_t ButtonPinR = D2;  // the number of the right button pin
const int8_t chipSelect = D3; // D3 for Seeed ESP32S3, 21 for Seeed Sense  // the number of Chip Select pin for the SD card
const int8_t TXpin = D6;  // the number of the TX pin
const int8_t RXpin = D7;  // the number of the RX pin

Those are not listed in https://github.com/espressif/arduino-esp32/blob/master/variants/esp32c3/pins_arduino.h

Found within xiao seed esp32c3 board.
https://github.com/espressif/arduino-esp32/blob/master/variants/XIAO_ESP32C3/pins_arduino.h

@frrhhhann
Copy link
Author

@frrhhhann - what are those pins:

// constants for arduino pins
const int8_t ButtonPinL = D1;  // the number of the left button pin
const int8_t ButtonPinR = D2;  // the number of the right button pin
const int8_t chipSelect = D3; // D3 for Seeed ESP32S3, 21 for Seeed Sense  // the number of Chip Select pin for the SD card
const int8_t TXpin = D6;  // the number of the TX pin
const int8_t RXpin = D7;  // the number of the RX pin

Those are not listed in https://github.com/espressif/arduino-esp32/blob/master/variants/esp32c3/pins_arduino.h

Found within xiao seed esp32c3 board. https://github.com/espressif/arduino-esp32/blob/master/variants/XIAO_ESP32C3/pins_arduino.h

i change the pin but still have rebooting problem

@SuGlider
Copy link
Collaborator

My suggestion is to run this sketch using Core Debug Level: "Verbose".
Add this line to the code:

void setup()
{
  pinMode(ButtonPinR, INPUT_PULLUP);
  pinMode(ButtonPinL, INPUT_PULLUP);

  Wire.begin();
  Serial.begin(115200); // usb connection on Arduino Nano
  Serial.setDebugOutput(true);  // <=== this line will force all Debug Output to go to USB CDC port

@frrhhhann
Copy link
Author

My suggestion is to run this sketch using Core Debug Level: "Verbose". Add this line to the code:

void setup()
{
  pinMode(ButtonPinR, INPUT_PULLUP);
  pinMode(ButtonPinL, INPUT_PULLUP);

  Wire.begin();
  Serial.begin(115200); // usb connection on Arduino Nano
  Serial.setDebugOutput(true);  // <=== this line will force all Debug Output to go to USB CDC port

i add this to the code but still no luck

Serial.setDebugOutput(true);  // <=== this line will force all Debug Output to go to USB CDC port

@me-no-dev
Copy link
Member

Did you set the core debug level to Verbose in the board menu?

@SuGlider
Copy link
Collaborator

20:47:40.604 -> Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled.

@frrhhhann - this is a memory fault error. Bad pointer.

I have found it... in splashStart().
frame value goes beyond the Speeduino_Logo_Anim_Array[frame] array boundary.

Fix it by if (frame >= \* ">" only is the bug *\ Speeduino_Logo_Anim_LEN) frame = 0;

@SuGlider
Copy link
Collaborator

No Arduino Core issue. This is user code failure.

@SuGlider SuGlider self-assigned this Jul 29, 2024
@frrhhhann
Copy link
Author

20:47:40.604 -> Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled.

@frrhhhann - this is a memory fault error. Bad pointer.

I have found it... in splashStart(). frame value goes beyond the Speeduino_Logo_Anim_Array[frame] array boundary.

Fix it by if (frame >= \* ">" only is the bug *\ Speeduino_Logo_Anim_LEN) frame = 0;

where do i need to replace the code?

// '01', 64x64px
const unsigned char Speeduino_Logo_Anim_01 [] PROGMEM = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 

@SuGlider
Copy link
Collaborator

SuGlider commented Jul 29, 2024

where do i need to replace the code?

In Graphics_Functions.ino file at Line 109

void splashStart(){
  int16_t centerX = (SCREEN_WIDTH - 64) / 2;
  int16_t centerY = (SCREEN_HEIGHT - 64) / 2;
  int16_t width = 64;
  int16_t height = 64;
  int16_t x1, y1;
  uint16_t w, h;
  int logoX; // offset for logo display based on screen orientation
  String noECU = "LOADING";
  int frame = 0;

  if (SCREEN_ROTATION == 0 || SCREEN_ROTATION == 2) logoX = 32;
  if (SCREEN_ROTATION == 1 || SCREEN_ROTATION == 3) logoX = 0;

  Serial.println("displaying logo");

  // Display initial boot animation
  for ( int i = 0; i < Speeduino_Logo_Anim_LEN ; i ++) {
  selectedOLED->clearDisplay();
  selectedOLED->drawBitmap(logoX, 0, Speeduino_Logo_Anim_Array[i], 64, 64, SH110X_WHITE);
  endPage();
  delay(50);
  }

  // Cycle boot animation until ECU is detected
  while (!ecuConnected) {
  selectedOLED->clearDisplay();
  selectedOLED->drawBitmap(logoX, 0, Speeduino_Logo_Anim_Array[frame], 64, 64, SH110X_WHITE);
  frame ++;
  if (frame >= Speeduino_Logo_Anim_LEN) frame = 0;  // <<<<<<<<<============================ HERE

  selectedOLED->getTextBounds(noECU,0,0,&x1, &y1, &w, &h);
  if (SCREEN_ROTATION == 0 || SCREEN_ROTATION == 2) selectedOLED->setCursor(SCREEN_WIDTH-w-4, SCREEN_HEIGHT-h-4);
  if (SCREEN_ROTATION == 1 || SCREEN_ROTATION == 3) selectedOLED->setCursor((SCREEN_WIDTH-w)/2, SCREEN_HEIGHT-h-4);
  selectedOLED->setTextSize(1);
  selectedOLED->setTextColor(SH110X_WHITE);
  selectedOLED->print("LOADING");

  endPage();
  delay(50);

  // is the Speeduino connected? Also, read the ECU's information into a buffer called "buffer"
  if (ecuWait < 5) ecuWait = 5; // don't wait less than 5ms for Speeduino to respond
  ecuConnected = requestData(ecuWait);

  }

}

@SuGlider SuGlider changed the title esp32c3 always rebooting [Application Failure - Bad Code] esp32c3 always rebooting Jul 29, 2024
@frrhhhann
Copy link
Author

when esp32 is not connected via rx tx pin d6 and d7 is works perfectly without rebooting, but when i connect to ecu via rx tx it keep rebooting

@SuGlider
Copy link
Collaborator

We don't have the hardware that you are using. So far it has been an application issue, not an Arduino Core code problem.

Please debug it and find out if there is any Arduino Core failure.
When you find any Arduino Core issue, create a minimum sketch that demonstrates it and post a new issue.
The issue must not contain or use any external library.

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Community help needed Issue need help from any member from the Community. Type: Question Only question
Projects
None yet
Development

No branches or pull requests

4 participants