ESP32 ESPWROOM 32 - NodeMCU-ESP-32S board sleep or freeze after running?

Sentinel80
Posts: 8
Joined: Fri Mar 04, 2022 11:06 am

ESP32 ESPWROOM 32 - NodeMCU-ESP-32S board sleep or freeze after running?

Postby Sentinel80 » Fri Mar 04, 2022 11:16 am

Im using to my project Esp32, because stronger than arduino boards.

Im new in using esp32 boards, i have noticed my board after 20-30 minute running - simple halt or i dont know. Arduino IDE gives no warning for code or error and code riunning well. After 20-30 minute i see the connected blinking LED (for test) and the OLED display wont light up. After pressing EN button working again.

The uploaded code controll a oled with SPI connection what receive analog reading values for displaying spectrum. Im running from USB power source and I have not defined any power management option, code looks running well.

Why Esp32 simple stop working after minutes? This is a automated power saving mode or defect?

After press EN i see in Arduino IDE serial monitor this log:

11:27:40.555 -> ets Jun 8 2016 00:22:57
11:27:40.555 ->
11:27:40.555 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
11:27:40.555 -> configsip: 0, SPIWP:0xee
11:27:40.555 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
11:27:40.555 -> mode:DIO, clock div:1
11:27:40.555 -> load:0x3fff0018,len:4
11:27:40.555 -> load:0x3fff001c,len:1216
11:27:40.555 -> ho 0 tail 12 room 4
11:27:40.555 -> load:0x40078000,len:10944
11:27:40.555 -> load:0x40080400,len:6388
11:27:40.603 -> entry 0x400806b4

thanks for any help.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 ESPWROOM 32 - NodeMCU-ESP-32S board sleep or freeze after running?

Postby ESP_Sprite » Sat Mar 05, 2022 1:33 am

Sounds like a bug. Could it be that your software can get locked up into some kind of loop if something unexpected happens?

Sentinel80
Posts: 8
Joined: Fri Mar 04, 2022 11:06 am

Re: ESP32 ESPWROOM 32 - NodeMCU-ESP-32S board sleep or freeze after running?

Postby Sentinel80 » Sat Mar 05, 2022 1:41 pm

ESP_Sprite wrote:
Sat Mar 05, 2022 1:33 am
Sounds like a bug. Could it be that your software can get locked up into some kind of loop if something unexpected happens?
Ok, i will send the code and a diagram, maybe something will be visible. Since i have posted this ,,error" i have maked few test, leaved running the esp32 without playing any sounds to input (no display used) or leaved running but still simple at one point stop running and continue the run only after pressing EN.

What i dont understand, how is possible compile a code without warning and run around a hour and just after making crash.

Another question is the debug/log, before compile (ESP32 Dev Modul selected as board) i can select the level of this, and i see after pressing EN a short log, but nothing happens whatever i select - this will be also help find the problem.

Sentinel80
Posts: 8
Joined: Fri Mar 04, 2022 11:06 am

Re: ESP32 ESPWROOM 32 - NodeMCU-ESP-32S board sleep or freeze after running?

Postby Sentinel80 » Sat Mar 05, 2022 1:42 pm

Code: Select all

#include "arduinoFFT.h" 
arduinoFFT FFT = arduinoFFT();
#include "SSD1306Spi.h"
SSD1306Spi display(17, 16, 5); 

#define SAMPLES 512              
#define SAMPLING_FREQUENCY 40000 
#define amplitude 1000           
unsigned int sampling_period_us;
unsigned long microseconds;
byte peak[] = {0,0,0,0,0,0,0};
double vReal[SAMPLES];
double vImag[SAMPLES];
unsigned long newTime, oldTime;

void setup() {
  
  Serial.begin(115200);
  display.init();
  display.flipScreenVertically(); 
  sampling_period_us = round(1000000 * (1.0 / SAMPLING_FREQUENCY));

}

void loop() {
  
  display.clear();
  display.drawString(0,0,"0.1 0.2 0.5 1K  2K  4K  8K");
  for (int i = 0; i < SAMPLES; i++) {
    newTime = micros()-oldTime;
    oldTime = newTime;
    vReal[i] = analogRead(A0); // A conversion takes about 1uS on an ESP32
    vImag[i] = 0;
    while (micros() < (newTime + sampling_period_us)) { /* do nothing to wait */ }
  }
  FFT.Windowing(vReal, SAMPLES, FFT_WIN_TYP_HAMMING, FFT_FORWARD);
  FFT.Compute(vReal, vImag, SAMPLES, FFT_FORWARD);
  FFT.ComplexToMagnitude(vReal, vImag, SAMPLES);
  for (int i = 2; i < (SAMPLES/2); i++){ 
    if (vReal[i] > 2000) { // Add a crude noise filter, 10 x amplitude or more
      if (i<=2 )             displayBand(0,(int)vReal[i]/amplitude); 
      if (i >3   && i<=5 )   displayBand(1,(int)vReal[i]/amplitude); 
      if (i >5   && i<=7 )   displayBand(2,(int)vReal[i]/amplitude); 
      if (i >7   && i<=15 )  displayBand(3,(int)vReal[i]/amplitude); 
      if (i >15  && i<=30 )  displayBand(4,(int)vReal[i]/amplitude); 
      if (i >30  && i<=53 )  displayBand(5,(int)vReal[i]/amplitude); 
      if (i >53  && i<=200 ) displayBand(6,(int)vReal[i]/amplitude); 
      if (i >200           ) displayBand(7,(int)vReal[i]/amplitude); 
      //Serial.println(i);
    }
    for (byte band = 0; band <= 6; band++) display.drawHorizontalLine(18*band,64-peak[band],14);
  }
  if (millis()%4 == 0) {for (byte band = 0; band <= 6; band++) {if (peak[band] > 0) peak[band] -= 1;}} // Decay the peak
  display.display();
}

void displayBand(int band, int dsize){
  int dmax = 50;
  if (dsize > dmax) dsize = dmax;
  if (band == 7) display.drawHorizontalLine(18*6,0, 14);
  for (int s = 0; s <= dsize; s=s+2){display.drawHorizontalLine(18*band,64-s, 14);}
  if (dsize > peak[band]) {peak[band] = dsize;}

}

Sentinel80
Posts: 8
Joined: Fri Mar 04, 2022 11:06 am

Re: ESP32 ESPWROOM 32 - NodeMCU-ESP-32S board sleep or freeze after running?

Postby Sentinel80 » Sat Mar 05, 2022 1:45 pm

And here is the wiring.
SAschematic.jpg
SAschematic.jpg (355.2 KiB) Viewed 4056 times
I have used this tutorial connect Esp32 with SPI OLED:

https://www.electronicshub.org/esp32-oled-display/

#define OLED_CLK 18
#define OLED_MOSI 23
#define OLED_CS 5
#define OLED_DC 16
#define OLED_RESET 17

Oled connected to 5V on Esp32 and the build receive power from PC USB port using microUSB cabel.

Sentinel80
Posts: 8
Joined: Fri Mar 04, 2022 11:06 am

Re: ESP32 ESPWROOM 32 - NodeMCU-ESP-32S board sleep or freeze after running?

Postby Sentinel80 » Sun Mar 06, 2022 6:28 am

Yesterday i have maked several test runs, using a simple serial.println command to test when stuck the esp32.

The result currently esp32 freeze without any SPI OLED connection too, so remains the code, the esp32 board or the analog connection/what use the 3v pin.

Now im testing the code with and without analog connection. I hope we will find the problem and will be possible handle.

Sentinel80
Posts: 8
Joined: Fri Mar 04, 2022 11:06 am

Re: ESP32 ESPWROOM 32 - NodeMCU-ESP-32S board sleep or freeze after running?

Postby Sentinel80 » Sun Mar 06, 2022 8:58 am

Now, just with the code on Esp32 without any other connection than micro USB power supply code/esp32 freezed.

Now two things remains, if somebody not have any other idea: the board itself or the code/loop making this halt.

Sentinel80
Posts: 8
Joined: Fri Mar 04, 2022 11:06 am

Re: ESP32 ESPWROOM 32 - NodeMCU-ESP-32S board sleep or freeze after running?

Postby Sentinel80 » Sun Mar 06, 2022 11:20 am

Another try - now the esp32 board driver version was 1.0.6, i have updated the esp32 driver directory in arduino ide settings and i saw a new 2.0.2 board driver, so i maked a update and re compiled again code.

https://raw.githubusercontent.com/espre ... index.json

Sentinel80
Posts: 8
Joined: Fri Mar 04, 2022 11:06 am

Re: ESP32 ESPWROOM 32 - NodeMCU-ESP-32S board sleep or freeze after running?

Postby Sentinel80 » Mon Mar 07, 2022 7:04 am

I have runned out from any type of workaround, at last i have returned to a older board driver 1.0.4 and set as board type NodeMCU-32s against Esp32 dev module - so looks i have von some speed - thats was visible on screen refresh - but still around 1 hour running board freezing.

As extra i have tryed a independent, external 5V power supply + add a capacitor between + - (supplied to esp32 5V+GND legs, and OLED was connected to 3.3V, but still after 1 hour stuck, just if im press EN will start again.

So can be the cheaper board or still the code what generate this event.

Who is online

Users browsing this forum: No registered users and 87 guests