ESP8266 Thing not booting most of the time and doesn’t connect to wifi when booted

Hi,

I purchased one of these a little while ago and now have time to work on it.

I can load my program OK (via Arduino 1.8.13 on mac, ESP8266 3.0.1 core).

But it quite often fails to boot with the following output. Seems to hand at the ~ld

18:03:14.255 → ets Jan 8 2013,rst cause:1, boot mode:(3,6)

18:03:14.255 →

18:03:14.255 → load 0x4010f000, len 3460, room 16

18:03:14.288 → tail 4

18:03:14.288 → chksum 0xcc

18:03:14.288 → load 0x3fff20b8, len 40, room 4

18:03:14.288 → tail 4

18:03:14.288 → chksum 0xc9

18:03:14.288 → csum 0xc9

18:03:14.288 → v0004d6f0

18:03:14.323 → ~ld

18:03:18.922 →

When it does boot it crashes when attempting to connect to wifi. Note this program is working fine on my older unit with ESP-07

18:00:56.681 → ets Jan 8 2013,rst cause:1, boot mode:(3,6)

18:00:56.681 →

18:00:56.681 → load 0x4010f000, len 3460, room 16

18:00:56.681 → tail 4

18:00:56.681 → chksum 0xcc

18:00:56.681 → load 0x3fff20b8, len 40, room 4

18:00:56.681 → tail 4

18:00:56.681 → chksum 0xc9

18:00:56.681 → csum 0xc9

18:00:56.681 → v0004d6f0

18:00:56.716 → ~ld

18:00:56.753 → Initialising

18:00:56.753 → read rtc memory complete

18:00:56.753 → No valid data - reset to defaults

18:00:56.753 → I/O setup complete

18:00:56.786 → Connecting to Wifi …

18:00:56.786 → …⸮@⸮rjrA(⸮⸮S⸮u⸮К⸮⸮X%(⸮⸮⸮y⸮eh)⸮"8⸮t⸮͊N⸮⸮I

18:01:08.871 → A⸮1⸮-1)dЋUJ!⸮⸮A⸮!⸮N⸮*Q"HhI⸮A,⸮ZMmr,R⸮+⸮⸮YJvA ⸮y⸮!!⸮$|⸮⸮⸮⸮⸮A,⸮[

⸮⸮A,⸮[

G,9E-␟⸮ ⸮x⸮xjxjx⸮x*&⸮"⸮⸮&2⸮⸮($ᑢ⸮V<jxj8j8.x⸮axjxjxjxjx*&⸮V"5⸮⸮"N b⸮(&b⸮⸮⸮⸮ᩡ⸮⸮⸮⸮⸮xjxjx/8jx*⸮hf@n ⸮2F⸮⸮ArF24⸮⸮⸮⸮⸮⸮

18:01:29.586 → ets Jan 8 2013,rst cause:1, boot mode:(3,6)

18:01:29.586 →

18:01:29.586 → load 0x4010f000, len 3460, room 16

18:01:29.586 → tail 4

I has also exceptioned a few times with the output decoded to:

Exception 0: Illegal instruction

PC: 0x40104c02

EXCVADDR: 0x00000000

Decoding stack results

0x40100a23: umm_free_core(umm_heap_context_t*, void*) at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/umm_malloc/umm_malloc.cpp line 549

0x40100c02: free(void*) at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/umm_malloc/umm_malloc.cpp line 595

0x40209686: loop_task(ETSEvent*) at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/core_esp8266_main.cpp line 215

0x401003d4: ets_post(uint8, ETSSignal, ETSParam) at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/core_esp8266_main.cpp line 181

0x402021ed: ESP8266WiFiSTAClass::begin(char const*, char const*, int, unsigned char const*, bool) at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp line 208

0x402021ca: ESP8266WiFiSTAClass::begin(char const*, char const*, int, unsigned char const*, bool) at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp line 204

0x402021f3: ESP8266WiFiSTAClass::begin(char const*, char const*, int, unsigned char const*, bool) at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp line 208

0x401004f4: millis() at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/core_esp8266_wiring.cpp line 193

0x40100a23: umm_free_core(umm_heap_context_t*, void*) at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/umm_malloc/umm_malloc.cpp line 549

0x4020a7dc: uart_write(uart_t*, char const*, size_t) at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/uart.cpp line 546

0x40100c2c: malloc(size_t) at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/umm_malloc/umm_malloc.cpp line 821

0x4020184c: setup() at /Users/alanforster/Documents/Arduino/ChookDoor/ChookDoor.ino line 349

0x40209830: loop_wrapper() at /Users/alanforster/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/core_esp8266_main.cpp line 205

Any thoughts?

extract of the program setup:

void setup() {

int i = 0;

// Debug Console

Serial.begin(74880);

Serial.println(“Initialising”);

// get restore data

if (!ESP.rtcUserMemoryRead(0, (uint32_t*) &rtcData, sizeof(rtcData))) {

// read failed, this is a major fault so stop

Serial.println(“rtcUserMemoryRead failed”);

return;

}

Serial.println(“read rtc memory complete”);

WiFi.mode(WIFI_STA);

WiFi.hostname(HOSTNAME);

// we have started or restarted from power outage so restore data

if (rtcData.validity) {

// no valid data

Serial.println(“No valid data - reset to defaults”);

rtcData.validity = 0;

} else {

// valid data so setup from rtc data

Serial.println(“Initialising from stored data”);

}

// Setup I/O

Serial.println(“I/O setup complete”);

// Wait for the Wi-Fi to connect for 15 seconds then give up

Serial.println(“Connecting to Wifi …”);

if (!wifiOn) {

WiFi.begin(ssid, pass);

// try this for 10 seconds

for (int i = 0; i < 20 && WL_CONNECTED != WiFi.status(); ++i) {

Serial.print(“.”);

delay(500);

}

Serial.println(“”);