1

I'm trying to use WiFi on a ESP8266EX based board (XTVTX WEMOS D1 Mini Pro).

The sketch is really simple.

#include <ESP8266WiFi.h>

void setup() {
  Serial.begin(9600);

  WiFi.begin("<ssid>", "<password>");
}

void loop() {
  if ( WiFi.status() == WL_CONNECTED)
  {
    Serial.println("Connected");
  }
  else 
  {
    Serial.println("Not Connected");
  }

  yield();
}

The board keeps rebooting for a watchdog reset (source: https://arduino-esp8266.readthedocs.io/en/latest/boards.html#rst-cause).

After a few seconds a fatal exception is raised (28 = LoadProhibitedCause - source: https://arduino-esp8266.readthedocs.io/en/latest/exception_causes.html#exception-causes-exccause).

Here it is the log that shows the issue.

 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 3424, room 16 
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8 
tail 0
chksum 0x2b
csum 0x2b
v00044b80
~ld
sp 0x3fffe9d0 
epc1=0x40204d1a, epc2=0x00000000, epc3=0x00000000, excvaddr=0x04000102, depc=0x00000000
Fatal exception (28): 
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00007ff0, depc=0x00000000
Fatal exception (28): 
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00007ff0, depc=0x00000000
Fatal exception (28): 
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00007ff0, depc=0x00000000
Fatal exception (28): 
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00007ff0, depc=0x00000000
Fatal exception (28): 
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00007ff0, depc=0x00000000
Fatal exception (28): 
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00007ff0, depc=0x00000000
Fatal exception (28): 
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00007ff0, depc=0x00000000
Fatal exception (28): 
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00007ff0, depc=0x00000000
[...]

My setup:

  • Power: USB 3.0 powered hub (5V 500mA)
  • IDE: Arduino IDE v2.0.4 on Linux
  • Library: esp8266 from ESP8266 Community v3.1.1 (tried also 3.1.0 and 3.0.2)
  • Programmer settings:
    • Board: Generic ESP8266 Module
    • Upload speed: 115200
    • Crystal Frequency: 26MHz
    • Flash Size: 4MB (FS: none OTA: 1MB)
    • CPU Frequency: 80MHz
    • MMU: 32KB cache + 32 KB IRAM
    • lwip variant: v2 lower memory
    • NONOS SDK: nonos-sdk 2.2.1+100
    • Erase flash: all flash content
    • Flash frequency: 40MHz

Every other sketch which does not involve the use of WiFi is working without issues.

This sketch works fine on the AzDelivery ESP8266MOD 12-F board which is very similar.

The board is new and I've seen the WiFi working for a few seconds before entering in the boot loop.

Other people with the same behavior were using #include <WiFi.h> instead of #include <ESP8266WiFi.h>, so this is not my case.

I can't understand what is the problem. Has anyone faced this problem before and found a solution?

Thank you for your time.

3
  • 1
    the cause is insufficient powering or too high wifi consumption problem. arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/… Commented Mar 12, 2023 at 10:04
  • With WiFi.setOutputPower(19.25); works fine. Higher values raise the problem. Thank you! Commented Mar 12, 2023 at 11:07
  • this indicates problems with the antenna or garbage values in system area in flash where WiFi calibration should be stored Commented Mar 12, 2023 at 15:35

2 Answers 2

0

As suggested by @Juraj (see comments below the question) the problem is the power consumption of this board.

I've modified the sketch in this way:

#include <ESP8266WiFi.h>

void setup() {
  Serial.begin(9600);

  // >>>>>
  // set the maximum tx power (Values range from 0 to 20.5 [dBm] inclusive)
  WiFi.setOutputPower(19.25);
  // <<<<<

  WiFi.begin("<ssid>", "<password>");
}

void loop() {
  if ( WiFi.status() == WL_CONNECTED)
  {
    Serial.println("Connected");
  }
  else 
  {
    Serial.println("Not Connected");
  }

  yield();
}

When values higher than 19.25 are set, the board resets every time a connection with the AP is established.

See the documentation here https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/generic-class.html#setoutputpower.

Thanks to @Juraj for the quick support!

Sign up to request clarification or add additional context in comments.

Comments

0

Try adding a while loop in setup() to wait until the WiFi connection is established

#include <ESP8266WiFi.h>
void setup() {
  Serial.begin(9600);
  WiFi.begin("<ssid>", "<password>");
  while (WiFi.status() != WL_CONNECTED);
  delay(1000);
}

void loop() {
  if (WiFi.status() == WL_CONNECTED) {
    Serial.println("Connected");
  } else {
    Serial.println("Not connected");
  }
  delay(1000);
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.