ESP32 keeps rebooting

Hey guys.
I'm trying to port a working program from an Arduino Nano to an ESP32 Wroom, but it just keeps rebooting.
Since I'm all new to the ESP32, I'm not used to it but it keeps printing out this in the serial monitor:

14:23:25.580 -> rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
14:23:25.580 -> configsip: 0, SPIWP:0xee
14:23:25.580 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
14:23:25.580 -> mode:DIO, clock div:1
14:23:25.613 -> load:0x3fff0030,len:1344
14:23:25.613 -> load:0x40078000,len:13924
14:23:25.613 -> ho 0 tail 12 room 4
14:23:25.613 -> load:0x40080400,len:3600
14:23:25.613 -> entry 0x400805f0
14:23:25.890 -> E (8) leets Jul 29 2019 12:21:46

Can anyone help point me in the right direction to what this all means, and what may indicate a problem, so I can figure out why it's rebooting?
Thanks!

Moved to the Programming Questions category as it seemed more relevant.

You mean the program we can't see because you didn't post it?

Yeah I wanted to try to solve any program specific issues myself first, so this initial question is more related to what the serial printout means. So I can interpret those printouts in the future :slight_smile:

That is just the esp32 boot message, all esp32's display something similar if rebooted at a baud rate of 115200.

Can't tell from the boot message, will need the code.

Thank you.
I thought the E(8) part at least was some kind of error code :slight_smile:

Looks like a ESP32 boot\reset message to me too.

Did you Google it ?

As others have mentioned, it's a reset caused by a timeout of the watchdog timer. So, the problem is specific to your program.

Understood guys. Can't see something specific that might be the cause though, with my inexperience :slight_smile:
My code is attached below, but haven't changed all pin settings in the beginning in case that might be the problem?

#include <DHT.h>
#include <TimeLib.h>
#include <RTClib.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Fonts/FreeMono9pt7b.h>
#include <NewPing.h>
#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
....

That's a lot of code and a lot of libraries. Did you build it up block-by-block on the ESP32 and get each module working before moving to the next? If so, the problem would likely be the last thing you added.

BTW, if your project will be connected to WiFi, you can drop the RTC hardware and library altogether and use the ESP32's internal RTC with NTP updates happening automatically, in the background.

I didn't. It worked on the Arduino Nano, and before trying to use it on the ESP32 I added has_display and has_rtc condition settings, so that I could try this without having to setup everything with display and rtc in the beginning.

That would be fantastic :slight_smile: Not sure it will always be connected though, but it would be perfect for when it can be! You wouldn't have a good tutorial link I can check out to see how I could add that to this project further on?

maybe try adding a yield() inside the nap function do while loop..

good luck.. ~q

How would that work? I mean what does it do?
And how do you mean it should be added?

like this..

 do {
    currentMillis = millis();
      yield();
    // OTA 
    if (use_OTA == 1) {
      ArduinoOTA.handle();
    }
  }
  while (currentMillis - previousMillis < msec);
}

ESP32 WDTS

really, it's a possible band-aide.. the sketch should not be using any nap like functions, loop should be fast, but would require allot of work..

good luck.. ~q

Agree. If it were my project, I'd rewrite it from scratch for ESP32 using the multi-tasking capabilities of that processor's built-in FreeRTOS.

The problem is I am too inexperienced in programming for microcontrollers to know how that works and what that would really mean for my program..
But as far as I've read, I shouldn't use delay() since it stops all activity during the set time and OTA updates won't work in the mean time.
Which is why I made the nap() function that essentially does the same thing but allows for the OTA updates at the same time.
But you're saying there's a way to pause the program that's better?
Or are you saying I shouldn't pause anything at all anytime, and just do things at a millisecond distance from each other?

inside of delay there's a call to yield..

Yes, using state machines and milli timers, only the code that needs to execute, executes..

Understood, try adding the yield..

good luck.. ~q

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