homieiot / homie-esp8266

💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
http://homieiot.github.io/homie-esp8266
MIT License
1.36k stars 307 forks source link

Cycle reload Exception (9) after AP start #702

Open Denages opened 3 years ago

Denages commented 3 years ago

I've built several projects using Homie. But for now, I have a weird trouble. I use Platform.io and esp8266 (esp12 1mb) module. It's connected to a separate DC power adapter (3.3V, 2.5A max) After flashing device goes into an infinity loop. What could be the reason?

Code:

#include <Homie.h>

void setup() {
  delay(1000);
  Serial.begin(115200);
  Serial << endl << endl;
  Homie_setFirmware("bare-minimum", "1.0.0"); // The underscore is not a typo! See Magic bytes
  Homie.setup();
}

void loop() {
  Homie.loop();
}

Log:


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

load 0x4010f000, len 3584, room 16 
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld

✖ /homie/config.json doesn't exist
Configuration invalid. Using CONFIG MODE
💡 Firmware bare-minimum (1.0.0)
🔌 Booting into config mode 🔌
Device ID is 18fe34fafb83
AP started as Homie-18fe34fafb83 with IP 192.168.123.1

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (9):
epc1=0x4022912e epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000049 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffd20 end: 3fffffc0 offset: 0190
3ffffeb0:  3ffef960 3ffffed0 3ffef960 4020db2c  
3ffffec0:  3ffef960 3ffef948 3ffef960 40222953  
3ffffed0:  2e777700 3fffff00 80fef960 4020deb8  
3ffffee0:  3ffef960 3ffefe88 3ffef948 402229b4  
3ffffef0:  00000000 3ffef948 3ffef860 4020466e  
3fffff00:  696d6f48 38312d65 34336566 62666166  
3fffff10:  00003338 feefeffe 3fffff30 3fff0268  
3fffff20:  4022a234 0000002a 017ba8c0 8120c910  
3fffff30:  4022b7e0 40220035 017ba8c0 4022a24c  
3fffff40:  4022a234 4022b848 00ffffff 4020cd25  
3fffff50:  00000000 3ffef9c8 3ffef790 3fff0268  
3fffff60:  00000000 3ffeff08 3ffef790 4020153d  
3fffff70:  4020c904 3fff0138 3ffe8eda 4020cd25  
3fffff80:  3fffdad0 00000000 3fff0138 3fff0268  
3fffff90:  3fffdad0 00000000 3ffef790 40201068  
3fffffa0:  feefeffe feefeffe 3fff0228 4020ef84  
3fffffb0:  feefeffe feefeffe 3ffe864c 40100f71  
<<<stack<<<
...

Decoder says:


Exception 9: LoadStoreAlignmentCause: Load or store to an unaligned address
PC: 0x4022912e
EXCVADDR: 0x00000049

platformio.ini:


[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino
build_flags = -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
lib_deps = https://github.com/homieiot/homie-esp8266.git
upload_resetmethod = nodemcu
monitor_speed = 115200
luebbe commented 3 years ago

You can add a monitor_filter to your pio config: https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#filters This saves you the extra decoder step.

First I'd replace the board=esp12e with board = esp01_1m. This is probably the reason, because by default an esp_01 is assumed to have 4mb of flash.

I'm wondering why you see the "ets .." line at all. Normally this is only visible when you set monitor speed to 74880 and serial begin to 74880 too. Otherwise you see garbage output before serial.begin(115200) kicks in;

Did you power cycle the device? Also I've read in several places that some devices need the flash to be erased completely before you can re-flash them.

Denages commented 3 years ago

@luebbe I've changed board to esp01_1m. The output became:


✖ /homie/config.json doesn't exist
Configuration invalid. Using CONFIG MODE
�
 ets Jan  8 2013,rst cause:2, boot mode:(3,0)

load 0x4010f000, len 3584, room 16 
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld

✖ /homie/config.json doesn't exist
Configuration invalid. Using CONFIG MODE
�
 ets Jan  8 2013,rst cause:2, boot mode:(3,0)

load 0x4010f000, len 3584, room 16 
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld

Also, tried to clear flash completely. And yes, tried to turn off power after flashing

kartom commented 3 years ago

Insufficient power supplies are known to cause resets. Are you sure that your power supply has enough capacity for the current spikes from the ESP? Have you used that supply for other ESP projects? Otherwise i suggest you try to put a capacitor >=22uF on the power to see if that helps.