ESP8266 报错Exception (29):重启
代码如下#include <ESP8266WiFi.h>
#include <PubSubClient.h>
// Update these with values suitable for your network.
const char* ssid = "ssid";
const char* password = "password";
const char* mqttServer = "IP";
const int mqttPort = 端口;
const char* mqttUserName = "admin";
const char* mqttPassword = "password";
const char* lightTopic = "12";
const char* willTopic = "123";
const char* onlineTopic = "1234";
const char* clientId = "12345";
WiFiClient espClient;
PubSubClient client(espClient);
int lightPin = 14;
void setup_wifi() {
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void callback(char* topic, byte* payload, unsigned int length) {
Serial.println(topic);
String command = "";
for (int i = 0; i < length; i++) {
command += (char)payload;
}
Serial.println(command);
handlePayload(String(topic), command);
}
void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
//详细参数说明请查看文档
if (client.connect(clientId,mqttUserName,mqttPassword,willTopic,1,0,clientId)) {
Serial.println("connected");
client.publish(onlineTopic, clientId);
client.subscribe(lightTopic, 1);
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
}
void setup() {
pinMode(BUILTIN_LED, OUTPUT); // Initialize the BUILTIN_LED pin as an output
Serial.begin(115200);
setup_wifi();
client.setServer(mqttServer, mqttPort);
client.setCallback(callback);
}
void loop() {
if (!client.connected()) {
reconnect();
}
client.loop();
}
//处理命令
String handlePayload(String topic, String payload) {
if (String(lightTopic).equals(topic)) {
//light command
if (String("lightOn").equals(payload)) {
digitalWrite(lightPin, HIGH);
} else if (String("lightOff").equals(payload)) {
digitalWrite(lightPin, LOW);
}
}
}
串口监视器给出以下信息然后重启
Exception (29):
epc1=0x4021938b epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000004 depc=0x00000000
>>>stack>>>
ctx: sys
sp: 3fffed50 end: 3fffffb0 offset: 01a0
3fffeef0:3ffec760 4021db2c 3ffec760 3ffe95ac
3fffef00:3ffe95ac 00000052 00000000 00000047
3fffef10:00000002 0000001a 4022741b 3ffec760
3fffef20:3ffe95a0 3fffdcc0 3ffe8dc8 3ffe8dc8
3fffef30:00000080 3ffec760 00000000 3ffe8530
3fffef40:40226cdb 3fffdab0 00000000 40204823
3fffef50:3ffe8dc8 40000f49 3fffdab0 40000f49
3fffef60:40000e19 40001878 00000002 3fffffb0
3fffef70:3fffff10 aa55aa55 000000fa 401048a8
3fffef80:401048ae 00000002 3fffffb0 620580da
3fffef90:4010000d b248de75 a3d75cf1 399bd9f7
3fffefa0:00000000 3fffef3c 00000000 3fffff08
3fffefb0:3fffffc0 00000000 00000000 feefeffe
3fffefc0:feefeffe feefeffe feefeffe feefeffe
3fffefd0:feefeffe feefeffe feefeffe feefeffe
3fffefe0:feefeffe feefeffe feefeffe feefeffe
3fffeff0:feefeffe feefeffe feefeffe feefeffe
3ffff000:feefeffe feefeffe feefeffe feefeffe
3ffff010:feefeffe feefeffe feefeffe feefeffe
3ffff020:feefeffe feefeffe feefeffe feefeffe
3ffff030:feefeffe feefeffe feefeffe feefeffe
3ffff040:feefeffe feefeffe feefeffe feefeffe
3ffff050:feefeffe feefeffe feefeffe feefeffe
3ffff060:feefeffe feefeffe feefeffe feefeffe
3ffff070:feefeffe feefeffe feefeffe feefeffe
3ffff080:feefeffe feefeffe feefeffe feefeffe
3ffff090:feefeffe feefeffe feefeffe feefeffe
3ffff0a0:feefeffe feefeffe feefeffe feefeffe
3ffff0b0:feefeffe feefeffe feefeffe feefeffe
3ffff0c0:feefeffe feefeffe feefeffe feefeffe
3ffff0d0:feefeffe feefeffe feefeffe feefeffe
3ffff0e0:feefeffe feefeffe feefeffe feefeffe
3ffff0f0:feefeffe feefeffe feefeffe feefeffe
3ffff100:feefeffe feefeffe feefeffe feefeffe
3ffff110:feefeffe feefeffe feefeffe feefeffe
3ffff120:feefeffe feefeffe feefeffe feefeffe
3ffff130:feefeffe feefeffe feefeffe feefeffe
3ffff140:feefeffe feefeffe feefeffe feefeffe
3ffff150:feefeffe feefeffe feefeffe feefeffe
3ffff160:feefeffe feefeffe feefeffe feefeffe
3ffff170:feefeffe feefeffe feefeffe feefeffe
3ffff180:feefeffe feefeffe feefeffe feefeffe
3ffff190:feefeffe feefeffe feefeffe feefeffe
3ffff1a0:feefeffe feefeffe feefeffe feefeffe
3ffff1b0:feefeffe feefeffe feefeffe feefeffe
3ffff1c0:feefeffe feefeffe feefeffe feefeffe
3ffff1d0:feefeffe feefeffe feefeffe feefeffe
3ffff1e0:feefeffe feefeffe feefeffe feefeffe
3ffff1f0:feefeffe feefeffe feefeffe feefeffe
3ffff200:feefeffe feefeffe feefeffe feefeffe
3ffff210:feefeffe feefeffe feefeffe feefeffe
3ffff220:feefeffe feefeffe feefeffe feefeffe
3ffff230:feefeffe feefeffe feefeffe feefeffe
3ffff240:feefeffe feefeffe feefeffe feefeffe
3ffff250:feefeffe feefeffe feefeffe feefeffe
3ffff260:feefeffe feefeffe feefeffe feefeffe
3ffff270:feefeffe feefeffe feefeffe feefeffe
3ffff280:feefeffe feefeffe feefeffe feefeffe
3ffff290:feefeffe feefeffe feefeffe feefeffe
3ffff2a0:feefeffe feefeffe feefeffe feefeffe
3ffff2b0:feefeffe feefeffe feefeffe feefeffe
3ffff2c0:feefeffe feefeffe feefeffe feefeffe
3ffff2d0:feefeffe feefeffe feefeffe feefeffe
3ffff2e0:feefeffe feefeffe feefeffe feefeffe
3ffff2f0:feefeffe feefeffe feefeffe feefeffe
3ffff300:feefeffe feefeffe feefeffe feefeffe
3ffff310:feefeffe feefeffe feefeffe feefeffe
3ffff320:feefeffe feefeffe feefeffe feefeffe
3ffff330:feefeffe feefeffe feefeffe feefeffe
3ffff340:feefeffe feefeffe feefeffe feefeffe
3ffff350:feefeffe feefeffe feefeffe feefeffe
3ffff360:feefeffe feefeffe feefeffe feefeffe
3ffff370:feefeffe feefeffe feefeffe feefeffe
3ffff380:feefeffe feefeffe feefeffe feefeffe
3ffff390:feefeffe feefeffe feefeffe feefeffe
3ffff3a0:feefeffe feefeffe feefeffe feefeffe
3ffff3b0:feefeffe feefeffe feefeffe feefeffe
3ffff3c0:feefeffe feefeffe feefeffe feefeffe
3ffff3d0:feefeffe feefeffe feefeffe feefeffe
3ffff3e0:feefeffe feefeffe feefeffe feefeffe
3ffff3f0:feefeffe feefeffe feefeffe feefeffe
3ffff400:feefeffe feefeffe feefeffe feefeffe
3ffff410:feefeffe feefeffe feefeffe feefeffe
3ffff420:feefeffe feefeffe feefeffe feefeffe
3ffff430:feefeffe feefeffe feefeffe feefeffe
3ffff440:feefeffe feefeffe feefeffe feefeffe
3ffff450:feefeffe feefeffe feefeffe feefeffe
3ffff460:feefeffe feefeffe feefeffe feefeffe
3ffff470:feefeffe feefeffe feefeffe feefeffe
3ffff480:feefeffe feefeffe feefeffe feefeffe
3ffff490:feefeffe feefeffe feefeffe feefeffe
3ffff4a0:feefeffe feefeffe feefeffe feefeffe
3ffff4b0:feefeffe feefeffe feefeffe feefeffe
3ffff4c0:feefeffe feefeffe feefeffe feefeffe
3ffff4d0:feefeffe feefeffe feefeffe feefeffe
3ffff4e0:feefeffe feefeffe feefeffe feefeffe
3ffff4f0:feefeffe feefeffe feefeffe feefeffe
3ffff500:feefeffe feefeffe feefeffe feefeffe
3ffff510:feefeffe feefeffe feefeffe feefeffe
3ffff520:feefeffe feefeffe feefeffe feefeffe
3ffff530:feefeffe feefeffe feefeffe feefeffe
3ffff540:feefeffe feefeffe feefeffe feefeffe
3ffff550:feefeffe feefeffe feefeffe feefeffe
3ffff560:feefeffe feefeffe feefeffe feefeffe
3ffff570:feefeffe feefeffe feefeffe feefeffe
3ffff580:feefeffe feefeffe feefeffe feefeffe
3ffff590:feefeffe feefeffe feefeffe feefeffe
3ffff5a0:feefeffe feefeffe feefeffe feefeffe
3ffff5b0:feefeffe feefeffe feefeffe feefeffe
3ffff5c0:feefeffe feefeffe feefeffe feefeffe
3ffff5d0:feefeffe feefeffe feefeffe feefeffe
3ffff5e0:feefeffe feefeffe feefeffe feefeffe
3ffff5f0:feefeffe feefeffe feefeffe feefeffe
3ffff600:feefeffe feefeffe feefeffe feefeffe
3ffff610:feefeffe feefeffe feefeffe feefeffe
3ffff620:feefeffe feefeffe feefeffe feefeffe
3ffff630:feefeffe feefeffe feefeffe feefeffe
3ffff640:feefeffe feefeffe feefeffe feefeffe
3ffff650:feefeffe feefeffe feefeffe feefeffe
3ffff660:feefeffe feefeffe feefeffe feefeffe
3ffff670:feefeffe feefeffe feefeffe feefeffe
3ffff680:feefeffe feefeffe feefeffe feefeffe
3ffff690:feefeffe feefeffe feefeffe feefeffe
3ffff6a0:feefeffe feefeffe feefeffe feefeffe
3ffff6b0:feefeffe feefeffe feefeffe feefeffe
3ffff6c0:feefeffe feefeffe feefeffe feefeffe
3ffff6d0:feefeffe feefeffe feefeffe feefeffe
3ffff6e0:feefeffe feefeffe feefeffe feefeffe
3ffff6f0:feefeffe feefeffe feefeffe feefeffe
3ffff700:feefeffe feefeffe feefeffe feefeffe
3ffff710:feefeffe feefeffe feefeffe feefeffe
3ffff720:feefeffe feefeffe feefeffe feefeffe
3ffff730:feefeffe feefeffe feefeffe feefeffe
3ffff740:feefeffe feefeffe feefeffe feefeffe
3ffff750:feefeffe feefeffe feefeffe feefeffe
3ffff760:feefeffe feefeffe feefeffe feefeffe
3ffff770:feefeffe feefeffe feefeffe feefeffe
3ffff780:feefeffe feefeffe feefeffe feefeffe
3ffff790:feefeffe feefeffe feefeffe feefeffe
3ffff7a0:feefeffe feefeffe feefeffe feefeffe
3ffff7b0:feefeffe feefeffe feefeffe feefeffe
3ffff7c0:feefeffe feefeffe feefeffe feefeffe
3ffff7d0:feefeffe feefeffe feefeffe feefeffe
3ffff7e0:feefeffe feefeffe feefeffe feefeffe
3ffff7f0:feefeffe feefeffe feefeffe feefeffe
3ffff800:feefeffe feefeffe feefeffe feefeffe
3ffff810:feefeffe feefeffe feefeffe feefeffe
3ffff820:feefeffe feefeffe feefeffe feefeffe
3ffff830:feefeffe feefeffe feefeffe feefeffe
3ffff840:feefeffe feefeffe feefeffe feefeffe
3ffff850:feefeffe feefeffe feefeffe feefeffe
3ffff860:feefeffe feefeffe feefeffe feefeffe
3ffff870:feefeffe feefeffe feefeffe feefeffe
3ffff880:feefeffe feefeffe feefeffe feefeffe
3ffff890:feefeffe feefeffe feefeffe feefeffe
3ffff8a0:feefeffe feefeffe feefeffe feefeffe
3ffff8b0:feefeffe feefeffe feefeffe feefeffe
3ffff8c0:feefeffe feefeffe feefeffe feefeffe
3ffff8d0:feefeffe feefeffe feefeffe feefeffe
3ffff8e0:feefeffe feefeffe feefeffe feefeffe
3ffff8f0:feefeffe feefeffe feefeffe feefeffe
3ffff900:feefeffe feefeffe feefeffe feefeffe
3ffff910:feefeffe feefeffe feefeffe feefeffe
3ffff920:feefeffe feefeffe feefeffe feefeffe
3ffff930:feefeffe feefeffe feefeffe feefeffe
3ffff940:feefeffe feefeffe feefeffe feefeffe
3ffff950:feefeffe feefeffe feefeffe feefeffe
3ffff960:feefeffe feefeffe feefeffe feefeffe
3ffff970:feefeffe feefeffe feefeffe feefeffe
3ffff980:feefeffe feefeffe feefeffe feefeffe
3ffff990:feefeffe feefeffe feefeffe feefeffe
3ffff9a0:feefeffe feefeffe feefeffe feefeffe
3ffff9b0:feefeffe feefeffe feefeffe feefeffe
3ffff9c0:feefeffe feefeffe feefeffe feefeffe
3ffff9d0:feefeffe feefeffe feefeffe feefeffe
3ffff9e0:feefeffe feefeffe feefeffe feefeffe
3ffff9f0:feefeffe feefeffe feefeffe feefeffe
3ffffa00:feefeffe feefeffe feefeffe feefeffe
3ffffa10:feefeffe feefeffe feefeffe feefeffe
3ffffa20:feefeffe feefeffe feefeffe feefeffe
3ffffa30:feefeffe feefeffe feefeffe feefeffe
3ffffa40:feefeffe feefeffe feefeffe feefeffe
3ffffa50:feefeffe feefeffe feefeffe feefeffe
3ffffa60:feefeffe feefeffe feefeffe feefeffe
3ffffa70:feefeffe feefeffe feefeffe feefeffe
3ffffa80:feefeffe feefeffe feefeffe feefeffe
3ffffa90:feefeffe feefeffe feefeffe feefeffe
3ffffaa0:feefeffe feefeffe feefeffe feefeffe
3ffffab0:feefeffe feefeffe feefeffe feefeffe
3ffffac0:feefeffe feefeffe feefeffe feefeffe
3ffffad0:feefeffe feefeffe feefeffe feefeffe
3ffffae0:feefeffe feefeffe feefeffe feefeffe
3ffffaf0:feefeffe feefeffe feefeffe feefeffe
3ffffb00:feefeffe feefeffe feefeffe feefeffe
3ffffb10:feefeffe feefeffe feefeffe feefeffe
3ffffb20:feefeffe feefeffe feefeffe feefeffe
3ffffb30:feefeffe feefeffe feefeffe feefeffe
3ffffb40:feefeffe feefeffe feefeffe feefeffe
3ffffb50:00000002 00000000 00000020 4010139e
3ffffb60:3ffe8cd2 40104784 3ffec468 feefeffe
3ffffb70:00000001 401039a7 3ffece98 feefeffe
3ffffb80:40103e0a feefeffe feefeffe feefeffe
3ffffb90:feefeffe feefeffe feefeffe feefeffe
3ffffba0:401038ee 00000042 7fffffff 00000002
3ffffbb0:00000142 feefeffe feefeffe feefeffe
3ffffbc0:40102763 00080000 feefeffe feefeffe
3ffffbd0:00000000 feefeffe 00002200 4000050c
3ffffbe0:3fffc278 40102460 3fffc200 00000022
3ffffbf0:3ffffc00 feefeffe 40227e37 00000001
3ffffc00:4020c65f 00000030 00000010 ffffffff
3ffffc10:4020c983 00000000 3ffef9cc 3ffefa02
3ffffc20:00000066 00009275 00000000 00000000
3ffffc30:ffffff80 00000080 00000002 3ffef9cc
3ffffc40:3ffeec04 3ffef9cc 40227e37 00000001
3ffffc50:ffffffff 00000000 3ffe8e21 00000008
3ffffc60:40227e86 3ffec440 3ffeee4c 00000001
3ffffc70:40227f92 3ffec440 3ffeee4c 3ffec440
3ffffc80:00000002 00000000 00000020 4010139e
3ffffc90:3ffe8cd2 40226f43 3ffec440 3ffef9a8
3ffffca0:00000000 4021a1eb 3ffed8f8 3ffef9a8
3ffffcb0:00000000 00000002 00000000 3ffec440
3ffffcc0:3ffefa02 40104e27 3ffef9a8 3ffef214
3ffffcd0:3ffef9cc 40104e27 3ffef9a8 3ffef214
3ffffce0:00000000 00000000 0000001f 40105081
3ffffcf0:4000050c 00000043 3ffee810 3ffef214
3ffffd00:40102619 00000030 00000018 fffffffe
3ffffd10:00000000 00000000 00000001 80000000
3ffffd20:3fffdab0 00000000 00000038 00000000
3ffffd30:00000005 00000000 00000020 4010139e
3ffffd40:3ffe8cd5 4010479f 3ffec760 00000030
3ffffd50:00000005 00000000 00000020 4010139e
3ffffd60:3ffe8cd5 4010479f 3ffec760 40102286
3ffffd70:401020b5 3ffec760 00000000 00000000
3ffffd80:fffffff2 00539806 3ffed130 40102286
3ffffd90:3ffe9550 00000000 00000000 4010139e
3ffffda0:fffffff2 00539806 401026c6 00000100
3ffffdb0:7fffffff 3ffe9550 3ffe9550 00000001
3ffffdc0:00000001 00004288 3ffec760 40102286
3ffffdd0:401020b5 00539806 00002200 4000050c
3ffffde0:3fffc278 40102460 3fffc200 00000022
3ffffdf0:3ffe955c 00000000 00000000 00000001
3ffffe00:4000066a 00000030 00000010 ffffffff
3ffffe10:40100131 00539b4e 00418937 00418937
3ffffe20:00000000 0018bf60 00000000 fffffffe
3ffffe30:00002e2e 3fffc6fc 65e17b20 00539b4e
3ffffe40:00418937 00539b4e 00000000 00000030
3ffffe50:40204cf4 00000030 00000010 ffffffff
3ffffe60:40204cf4 00000001 00000001 00000000
3ffffe70:00000000 00000000 0000001f 40105081
3ffffe80:4000050c 3fffc6fc 00000001 3ffee5e8
3ffffe90:40000f83 00000030 00000010 ffffffff
3ffffea0:40000ea3 00000023 00000001 00000001
3ffffeb0:3fffdab0 00000000 3fffd9d0 3ffee758
3ffffec0:00000000 00000000 00000001 3ffee728
3ffffed0:00000000 3fffdad0 3ffee758 00000030
3ffffee0:ffffffff 3fffc6fc 00000001 3ffe8530
3ffffef0:00000000 4bc6a7f0 3ef9db22 00000000
3fffff00:00000000 00000000 4bc6a7f0 00000000
3fffff10:00000000 00000000 4010014c 00001567
3fffff20:00000000 3ffe8630 00000064 3fffff60
3fffff30:0018bf60 000007a8 3ffee5e8 40204b08
3fffff40:3ffe8639 00000001 3ffee5e8 40202d5b
3fffff50:3fffdad0 00000000 3ffee5e8 40203e64
3fffff60:3ffe8401 3ffee5e8 3ffee6f0 4020257c
3fffff70:00000000 3ffe862a 3ffee5e8 40203ffc
3fffff80:3fffdad0 00000000 3ffee5e8 3ffee758
3fffff90:00000000 00000000 00000001 40204889
3fffffa0:3fffdad0 00000000 3ffee728 4020491a
<<<stack<<<
last failed alloc call: 4010022C(20)
ets Jan8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v21db8fc9
~ld
请问这个该怎么解决 一般代码中都需要喂狗 bootmode等于3好像是软件开门狗复位
页:
[1]