Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By diffstorm
#34322 Hi,

I've simplified my code as much as I can.
I copy the sketch below and the output of it from the beginning.
Could you try it? Try to comment analogwrite line to see that it works.

Sketch:
Code: Select all#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266httpUpdate.h>
#include <WiFiUdp.h>
#include <FS.h>
#include <Ticker.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string>

#define WIFI_STASSID "test"
#define WIFI_STAPSK  "testtest0"
#define WIFI_APSSID  "test"
#define WIFI_APPSK   "1234567890"

void setup(void)
{
  delay(6000); // human time to connect to serial port
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Serial.flush();
  Serial.println("--------born");
  WiFi.printDiag(Serial);
  Serial.println("--------begin");
}

void loop(void)
{
  Serial.println("--------mode");
  WiFi.mode(WIFI_AP_STA);
  Serial.println("--------sta");
  WiFi.begin(WIFI_STASSID, WIFI_STAPSK);
  Serial.println("--------done");
  Serial.println(WiFi.status());
  Serial.println("--------exit");
  analogWrite(5, 100);
  Serial.println("--------well");
  delay(2000);
  Serial.println("--------best");
}



Serial output for first 3 resets :
17.11.2015 21:22:48.190 [RX] - --------born<CR><LF>
Mode: STA+AP<CR><LF>
PHY mode: N<CR><LF>
Channel: 11<CR><LF>
AP id: 0<CR><LF>
Status: 1<CR><LF>
Auto connect: 1<CR><LF>
SSID (4): test<CR><LF>
Passphrase (9): testtest0<CR><LF>
BSSID set: 0<CR><LF>
--------begin<CR><LF>
--------mode<CR><LF>
--------sta<CR><LF>
scandone<CR><LF>
f 0, --------done<CR><LF>
6<CR><LF>
--------exit<CR><LF>
--------well<CR><LF>
--------best<CR><LF>
--------mode<CR><LF>
--------sta<CR><LF>
Fatal exception (0):<CR><LF>
epc1=0x402022b0, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000<CR><LF>
<CR><LF>
Exception (0):<CR><LF>
epc1=0x402022b0 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000<CR><LF>
<CR><LF>
ctx: cont <CR><LF>
sp: 3ffebbd0 end: 3ffec020 offset: 01a0<CR><LF>
<CR><LF>
>>>stack>>><CR><LF>
3ffebd70: 400043e1 00000030 00000018 ffffffff <CR><LF>
3ffebd80: 400044ab 3fffc718 3ffebe70 08000000 <CR><LF>
3ffebd90: 60000200 08000000 08000000 00000000 <CR><LF>
3ffebda0: 0000ffff 00000001 04000002 000fd000 <CR><LF>
3ffebdb0: 3fff3950 000000fd 3fff1924 00000030 <CR><LF>
3ffebdc0: 402382d1 00000000 00000020 40001db4 <CR><LF>
3ffebdd0: 40001f46 00000004 00000001 ffffff80 <CR><LF>
3ffebde0: 00000000 00000006 4021a867 00000001 <CR><LF>
3ffebdf0: ffffffff 00000000 3ffeca61 00000008 <CR><LF>
3ffebe00: 4021a8b2 3fff0128 3fff1754 00000000 <CR><LF>
3ffebe10: 3fff1754 00000000 40103f23 3fff0128 <CR><LF>
3ffebe20: 00000000 00000000 00000020 40103e13 <CR><LF>
3ffebe30: 40219df8 3fff0128 3fff1038 3fff3000 <CR><LF>
3ffebe40: 4023e336 3fff0128 3fff0128 ffffff1a <CR><LF>
3ffebe50: 3ffe9c37 00000017 60000200 0000000a <CR><LF>
3ffebe60: 3fff0af2 3fff1780 3fff2d68 00000004 <CR><LF>
3ffebe70: 00000002 4000410f 3ffe9c37 3fff3507 <CR><LF>
3ffebe80: 3fffc718 40004a3c 000000fd 3fff3950 <CR><LF>
3ffebe90: 3fffc718 401017b4 00000378 00000000 <CR><LF>
3ffebea0: 000000fd 40214dff 00000378 000000ff <CR><LF>
3ffebeb0: 00001000 40214e95 3fff1924 000000ff <CR><LF>
3ffebec0: 000000fd 00000074 000fd000 3fff1924 <CR><LF>
3ffebed0: ffffff00 55aa55aa 00000002 0000001c <CR><LF>
3ffebee0: 0000001c 0000008d 000000ed 000000ff <CR><LF>
3ffebef0: 402152a5 3ffec290 00000001 3ffebf60 <CR><LF>
3ffebf00: 00000001 3ffebf80 402153ab 3ffec290 <CR><LF>
3ffebf10: 00000001 3ffebf60 00000074 3fff1814 <CR><LF>
3ffebf20: 3fff19e0 3ffebfc1 00000001 402153e2 <CR><LF>
3ffebf30: 3ffeac28 3ffe9350 3ffe9348 00000000 <CR><LF>
3ffebf40: 3ffebf80 0000000a 3ffec080 40209011 <CR><LF>
3ffebf50: 40203232 40203235 3ffeac28 402031bc <CR><LF>
3ffebf60: 74736574 00000000 3ffebf8e 4020a0e5 <CR><LF>
3ffebf70: 3ffeac5c 00000001 3ffec080 40209011 <CR><LF>
3ffebf80: 74736574 74736574 3ffe0030 40208308 <CR><LF>
3ffebf90: 3ffec080 00000001 3ffe99dd 40209ee4 <CR><LF>
3ffebfa0: 3ffec080 0000000a 3ffe9346 3ffec04c <CR><LF>
3ffebfb0: 3fffdc20 0000000b 3ffec080 40209011 <CR><LF>
3ffebfc0: 3ffe9900 3ffeac28 3ffec080 40209011 <CR><LF>
3ffebfd0: 00000004 00000000 3ffec080 40209fb8 <CR><LF>
3ffebfe0: 40202925 00000000 3ffec080 3ffec04c <CR><LF>
3ffebff0: 3fffdc20 3ffeac28 3ffec080 40202709 <CR><LF>
3ffec000: 00000000 00000000 3ffec044 40201c2a <CR><LF>
3ffec010: 00000000 00000000 3ffeb000 40100398 <CR><LF>
<<<stack<<<<CR><LF>
<CR><LF>
ets Jan 8 2013,rst cause:1, boot mode:(3,0)<CR><LF>
<CR><LF>
load 0x4010f000, len 1264, room 16 <CR><LF>
tail 0<CR><LF>
chksum 0x42<CR><LF>
csum 0x42<CR><LF>
~ld<LF>
--------born<CR><LF>
Mode: STA+AP<CR><LF>
PHY mode: N<CR><LF>
Channel: 11<CR><LF>
AP id: 0<CR><LF>
Status: 1<CR><LF>
Auto connect: 1<CR><LF>
SSID (4): test<CR><LF>
Passphrase (9): testtest0<CR><LF>
BSSID set: 0<CR><LF>
--------begin<CR><LF>
--------mode<CR><LF>
--------sta<CR><LF>
scandone<CR><LF>
f 0, --------done<CR><LF>
6<CR><LF>
--------exit<CR><LF>
--------well<CR><LF>
--------best<CR><LF>
--------mode<CR><LF>
--------sta<CR><LF>
Fatal exception (0):<CR><LF>
epc1=0x402022b0, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000<CR><LF>
<CR><LF>
Exception (0):<CR><LF>
epc1=0x402022b0 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000<CR><LF>
<CR><LF>
ctx: cont <CR><LF>
sp: 3ffebbd0 end: 3ffec020 offset: 01a0<CR><LF>
<CR><LF>
>>>stack>>><CR><LF>
3ffebd70: 400043e6 00000030 00000018 ffffffff <CR><LF>
3ffebd80: 400044ab 3fffc718 3ffebe70 08000000 <CR><LF>
3ffebd90: 60000200 08000000 08000000 00000000 <CR><LF>
3ffebda0: 0000ffff 00000001 04000002 000fd000 <CR><LF>
3ffebdb0: 3fff3950 000000fd 3fff1924 00000030 <CR><LF>
3ffebdc0: 40002ef1 00000030 3fffc230 4000050c <CR><LF>
3ffebdd0: 40214e92 00000030 00000018 ffffffff <CR><LF>
3ffebde0: 40214e76 000000fd 00001000 3fff1924 <CR><LF>
3ffebdf0: 00000378 04000002 3feffe00 00000100 <CR><LF>
3ffebe00: 0000001a 00000018 04000102 3fff1924 <CR><LF>
3ffebe10: 000000ff 000000fd 00000074 00000030 <CR><LF>
3ffebe20: 00000000 00000000 3fffc230 4000050c <CR><LF>
3ffebe30: 4000bd9c 00000030 00000019 ffffffff <CR><LF>
3ffebe40: 40000fb0 00000200 00000431 3fffc200 <CR><LF>
3ffebe50: 00000631 ffffffff 00000020 00000003 <CR><LF>
3ffebe60: 3ffeaf60 00000000 3ffebf86 00000004 <CR><LF>
3ffebe70: 00000002 4000410f 00000002 00000030 <CR><LF>
3ffebe80: 3fffc718 40004a3c 000000fd 3fff3950 <CR><LF>
3ffebe90: 3fffc718 401017b4 00000378 00000000 <CR><LF>
3ffebea0: 000000fd 40214dff 00000378 000000ff <CR><LF>
3ffebeb0: 00001000 40214e95 3fff1924 000000ff <CR><LF>
3ffebec0: 000000fd 00000074 000fd000 3fff1924 <CR><LF>
3ffebed0: ffffff00 55aa55aa 00000002 0000001c <CR><LF>
3ffebee0: 0000001c 0000008d 000000ed 000000ff <CR><LF>
3ffebef0: 402152a5 3ffec290 00000001 3ffebf60 <CR><LF>
3ffebf00: 00000001 3ffebf80 402153ab 3ffec290 <CR><LF>
3ffebf10: 00000001 3ffebf60 00000074 3fff1814 <CR><LF>
3ffebf20: 3fff19e0 3ffebfc1 00000001 402153e2 <CR><LF>
3ffebf30: 3ffeac28 3ffe9350 3ffe9348 00000000 <CR><LF>
3ffebf40: 3ffebf80 0000000a 3ffec080 40209011 <CR><LF>
3ffebf50: 40203232 40203235 3ffeac28 402031bc <CR><LF>
3ffebf60: 74736574 00000000 3ffebf8e 4020a0e5 <CR><LF>
3ffebf70: 3ffeac5c 00000001 3ffec080 40209011 <CR><LF>
3ffebf80: 74736574 74736574 3ffe0030 40208308 <CR><LF>
3ffebf90: 3ffec080 00000001 3ffe99dd 40209ee4 <CR><LF>
3ffebfa0: 3ffec080 0000000a 3ffe9346 3ffec04c <CR><LF>
3ffebfb0: 3fffdc20 0000000b 3ffec080 40209011 <CR><LF>
3ffebfc0: 3ffe9900 3ffeac28 3ffec080 40209011 <CR><LF>
3ffebfd0: 00000004 00000000 3ffec080 40209fb8 <CR><LF>
3ffebfe0: 40202925 00000000 3ffec080 3ffec04c <CR><LF>
3ffebff0: 3fffdc20 3ffeac28 3ffec080 40202709 <CR><LF>
3ffec000: 00000000 00000000 3ffec044 40201c2a <CR><LF>
3ffec010: 00000000 00000000 3ffeb000 40100398 <CR><LF>
<<<stack<<<<CR><LF>
<CR><LF>
ets Jan 8 2013,rst cause:1, boot mode:(3,0)<CR><LF>
<CR><LF>
load 0x4010f000, len 1264, room 16 <CR><LF>
tail 0<CR><LF>
chksum 0x42<CR><LF>
csum 0x42<CR><LF>
~ld<LF>
--------born<CR><LF>
Mode: STA+AP<CR><LF>
PHY mode: N<CR><LF>
Channel: 11<CR><LF>
AP id: 0<CR><LF>
Status: 1<CR><LF>
Auto connect: 1<CR><LF>
SSID (4): test<CR><LF>
Passphrase (9): testtest0<CR><LF>
BSSID set: 0<CR><LF>
--------begin<CR><LF>
--------mode<CR><LF>
--------sta<CR><LF>
scandone<CR><LF>
f 0, --------done<CR><LF>
6<CR><LF>
--------exit<CR><LF>
--------well<CR><LF>
--------best<CR><LF>
--------mode<CR><LF>
--------sta<CR><LF>
Fatal exception (0):<CR><LF>
epc1=0x402022b0, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, d<CR><LF>
Exception (0):<CR><LF>
epc1=0x402022b0 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000<CR><LF>
<CR><LF>
ctx: cont <CR><LF>
sp: 3ffebc20 end: 3ffec020 offset: 01a0<CR><LF>
<CR><LF>
>>>stack>>><CR><LF>
3ffebdc0: 4000485d 00000030 00000018 ffffffff <CR><LF>
3ffebdd0: 4010184f 0168a101 3feffe00 60000200 <CR><LF>
3ffebde0: fffdffff 04000001 fffffffe 04000001 <CR><LF>
3ffebdf0: 04000003 00000001 04000002 3ffebed0 <CR><LF>
3ffebe00: 0000001c 000ff000 00000074 00000030 <CR><LF>
3ffebe10: 3fff1754 00000000 40103f23 3fff0100 <CR><LF>
3ffebe20: 00000000 00000000 3fffc230 4000050c <CR><LF>
3ffebe30: 4000bd9c 00000030 00000019 ffffffff <CR><LF>
3ffebe40: 40000fb0 00000200 00000431 3fffc200 <CR><LF>
3ffebe50: 00000631 ffffffff 00000020 00000003 <CR><LF>
3ffebe60: 3ffeaf60 00000000 3ffebf86 00000004 <CR><LF>
3ffebe70: 00000001 3ffe8010 00000002 00000030 <CR><LF>
3ffebe80: 4023f9a3 3fff1cdc 3fff1db8 00000000 <CR><LF>
3ffebe90: 3fff1dd8 401014d7 40236118 00000000 <CR><LF>
3ffebea0: 00000001 00000000 40241084 3fff1dd8 <CR><LF>
3ffebeb0: 3fff1db8 3fff1dd8 00000025 00000000 <CR><LF>
3ffebec0: 40214e76 3fff1924 00000378 000000fd <CR><LF>
3ffebed0: 4023f639 00000001 0000010f 00000002 <CR><LF>
3ffebee0: 4023f5e1 3fff1cdc 0000010f 000000ff <CR><LF>
3ffebef0: 402152a5 3ffec290 00000001 3ffebf60 <CR><LF>
3ffebf00: 00000001 3ffebf80 402153ab 3ffec290 <CR><LF>
3ffebf10: 00000001 3ffebf60 00000074 3fff1814 <CR><LF>
3ffebf20: 3fff19e0 3ffebfc1 00000001 402153e2 <CR><LF>
3ffebf30: 3ffeac28 3ffe9350 3ffe9348 00000000 <CR><LF>
3ffebf40: 3ffebf80 0000000a 3ffec080 40209011 <CR><LF>
3ffebf50: 40203232 40203235 3ffeac28 402031bc <CR><LF>
3ffebf60: 74736574 00000000 3ffebf8e 4020a0e5 <CR><LF>
3ffebf70: 3ffeac5c 00000001 3ffec080 40209011 <CR><LF>
3ffebf80: 74736574 74736574 3ffe0030 40208308 <CR><LF>
3ffebf90: 3ffec080 00000001 3ffe99dd 40209ee4 <CR><LF>
3ffebfa0: 3ffec080 0000000a 3ffe9346 3ffec04c <CR><LF>
3ffebfb0: 3fffdc20 0000000b 3ffec080 40209011 <CR><LF>
3ffebfc0: 3ffe9900 3ffeac28 3ffec080 40209011 <CR><LF>
3ffebfd0: 00000004 00000000 3ffec080 40209fb8 <CR><LF>
3ffebfe0: 40202925 00000000 3ffec080 3ffec04c <CR><LF>
3ffebff0: 3fffdc20 3ffeac28 3ffec080 40202709 <CR><LF>
3ffec000: 00000000 00000000 3ffec044 40201c2a <CR><LF>
3ffec010: 00000000 00000000 3ffeb000 40100398 <CR><LF>
<<<stack<<<<CR><LF>
<CR><LF>
ets Jan 8 2013,rst cause:1, boot mode:(3,0)<CR><LF>
<CR><LF>
load 0x4010f000, len 1264, room 16 <CR><LF>
tail 0<CR><LF>
chksum 0x42<CR><LF>
csum 0x42<CR><LF>
~ld<LF>
User avatar
By martinayotte
#34326 I've gave it a shot, and I don't get any crash, simply "scandone" in the loop().
That ring me a possible power issue : do you have proper power supply along with a big decoupling capacitor nearby the powe pins of the ESP ?

Code: Select allf -180, --------done
6
--------exit
--------well
--------best
--------mode
--------sta
scandone
f 0, --------done
6
--------exit
--------well
--------best
--------mode
--------sta
scandone
f -180, --------done
6
--------exit
--------well
--------best
--------mode
--------sta
scandone
f 0, --------done
6
--------exit
--------well
--------best
--------mode
--------sta
scandone
User avatar
By diffstorm
#34329 Strange..
I have 3 x 10uF, 4 x 100nF and now I soldered a 220uF Electrolytic cap very near of ESP. Also I tried to supply it from USB and lipo battery too. I do not think it is power problem.

I've changed the code but still the same...

I have tried the other (4,12) pins with analogWrite too.
Any possible problem with pin 4 or 5 or 12 ? When I delete the analogWrite line it's the same like your result.

New code:
Code: Select all#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266httpUpdate.h>
#include <WiFiUdp.h>
#include <FS.h>
#include <Ticker.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string>

const char* WIFI_STASSID = "test";
const char* WIFI_STAPSK  = "testtest0";
const char* WIFI_APSSID  = "test";
const char* WIFI_APPSK   = "1234567890";

bool onetime = false;

void setup(void)
{
  delay(6000); // human time to connect to serial port
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Serial.flush();
  Serial.println("--------born");
  WiFi.printDiag(Serial);
  Serial.println("--------begin");
  WiFi.disconnect();
  WiFi.softAPdisconnect();
  WiFi.hostname(WIFI_STASSID);
  onetime = false;
}

void loop(void)
{
  if(onetime == false)
  {
    Serial.println("--------mode");
    WiFi.mode(WIFI_STA);
    Serial.println("--------sta");
    WiFi.begin(WIFI_STASSID, WIFI_STAPSK);
    Serial.println("--------done");
    Serial.println(WiFi.status());
    Serial.println("--------exit");
    //onetime = true;
  }
  analogWrite(5, 100);
  Serial.println("--------well");
  delay(2000);
  Serial.println("--------best");
}