Exception ESP8266在向服务器发出第二个请求后重新启动(异常9)
我是这个社区的新手,我期待着你在这个问题上的帮助。 我在两个Exception ESP8266在向服务器发出第二个请求后重新启动(异常9),exception,server,client,esp8266,restart,Exception,Server,Client,Esp8266,Restart,我是这个社区的新手,我期待着你在这个问题上的帮助。 我在两个ESP8266模块之间进行通信。其中一个作为服务器/访问点,另一个作为客户端。这两个模块之间的配置和连接是令人满意的,也是通信的一部分。但是,在客户端发出第一个请求(开始和获取)并且服务器响应后,对于第二个客户端/服务器请求,客户端将使用下一条消息或异常重新启动 Exception (9): epc1=0x40207204 epc2=0x00000000 epc3=0x00000000 excvaddr=0x0036006a depc=
ESP8266
模块之间进行通信。其中一个作为服务器/访问点,另一个作为客户端。这两个模块之间的配置和连接是令人满意的,也是通信的一部分。但是,在客户端
发出第一个请求(开始和获取)并且服务器
响应后,对于第二个客户端/服务器
请求,客户端将使用下一条消息或异常重新启动
Exception (9):
epc1=0x40207204 epc2=0x00000000 epc3=0x00000000 excvaddr=0x0036006a depc=0x00000000
也就是说,对服务器根目录的第一个请求得到响应,但对/data
的第二个请求导致在客户机上重新启动
查看堆栈异常解码器后,我发现代码(9)表示9:LoadStoreAlignmentCause加载或存储到未对齐的地址。
然后,我尝试了不同的解决方案
- 删除所有flash内容
- http.end()
- 将宏延迟()更改为延迟微秒()
- 还有一些
但目前还没有任何效果
请帮我解决这个问题。服务器和客户端的代码为:
客户:
#包括
#包括
#定义LED_引脚2
const char*ssid=“Mi_Servidor”;
const char*password=“”;
常量字符*主机=”http://192.168.4.1";
int计数器=1,httpCode=0;
HTTPClient-http;
void peticion(内部httpCode){
弦门萨结;
如果(httpCode==200){
mensaje=http.getString();
序列号println(mensaje);
}
否则{
Serial.print(“[HTTP]获取…失败,没有连接或没有HTTP服务器\n”);
}
}
无效设置(){
引脚模式(LED_引脚,输出);
序列号开始(115200);
延迟(10);
连续打印(“Conectando a”);
序列号println(ssid);
WiFi.模式(WiFi_STA);
WiFi.begin(ssid,密码);
while(WiFi.status()!=WL_已连接){
延迟(500);
连续打印(“.”);
}
Serial.println(“WiFi连接”);
Serial.println(“IP地址:”);
Serial.println(WiFi.localIP());
}
void循环(){
计数器++;
整数模=计数器%2;
如果(WiFi.status()!=WL_已连接){
WiFi.begin(ssid,密码);
while(WiFi.status()!=WL_已连接){
延迟(500);
连续打印(“.”);
}
}
否则{
Serial.print(“[HTTP]begin…\n”);
if(modulo==0)http.begin(“192.168.4.1”,80);//http
else http.begin(“192.168.4.1”,80,“/data”);//http
httpCode=http.GET();
Serial.print(“httpCode:”);//JJ
Serial.println(httpCode);//JJ
佩蒂西奥(httpCode);
延迟(20);
}
Serial.println(“结束循环!”);
}
和服务器:
#包括
#包括
#定义LED_引脚2
void handle_datos();
const char WiFiClave[]=“”//罪状
const char AP_Nombre[]=“Mi_Servidor”;
int-val;
String MiMessage=“要传输的消息:\n\r”;
ESP8266Web服务器(80);
无效句柄_数据(){
server.send(200,“文本/普通”,MiMessage);
延迟(1000);
}
void handle_root(){
send(200,“文本/普通”、“密文根”);
延迟(1000);
}
无效设置(){
引脚模式(LED_引脚,输出);
序列号开始(115200);
引脚模式(LED_引脚,输出);
数字写入(LED_引脚,低电平);
WiFi.模式(WiFi\u AP);
WiFi.softAP(AP_Nombre,WiFiClave);
在(“/data”上,处理\u数据);
server.on(“/”,handle\u root);
server.begin();
//对于(int i=0;我使用http.end()
或不重用对象(使其成为本地对象)使用http.end()
或不重用对象(使其成为本地对象)
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#define LED_PIN 2
const char* ssid = "Mi_Servidor";
const char* password = "";
const char* host = "http://192.168.4.1";
int counter=1, httpCode=0;
HTTPClient http;
void peticion (int httpCode){
String mensaje;
if(httpCode == 200) {
mensaje = http.getString();
Serial.println(mensaje);
}
else {
Serial.print("[HTTP] GET... failed, no connection or no HTTP server\n");
}
}
void setup() {
pinMode(LED_PIN, OUTPUT);
Serial.begin(115200);
delay(10);
Serial.print("Conectando a ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi conectada");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop(){
counter++;
int modulo=counter%2;
if(WiFi.status() != WL_CONNECTED){
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
}
else{
Serial.print("[HTTP] begin...\n");
if(modulo==0) http.begin("192.168.4.1", 80); //HTTp
else http.begin("192.168.4.1", 80, "/data"); //HTTp
httpCode = http.GET();
Serial.print("httpCode: "); //JJ
Serial.println(httpCode); //JJ
peticion(httpCode);
delay(20);
}
Serial.println("End Loop!");
}
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#define LED_PIN 2
void handle_datos();
const char WiFiClave[] = ""; //Sin clave
const char AP_Nombre[] = "Mi_Servidor";
int val;
String MiMessage = "Message to transmit:\n\r";
ESP8266WebServer server(80);
void handle_data() {
server.send(200, "text/plain", MiMessage);
delay(1000);
}
void handle_root() {
server.send(200, "text/plain", "Mi_root");
delay(1000);
}
void setup() {
pinMode(LED_PIN, OUTPUT);
Serial.begin(115200);
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
WiFi.mode(WIFI_AP);
WiFi.softAP(AP_Nombre, WiFiClave);
server.on("/data", handle_data);
server.on("/", handle_root);
server.begin();
// for (int i = 0; i <= 3999; i++) {
// MiMessage.concat(String(i));
// MiMessage.concat(";");
// }
Serial.println();
Serial.println(MiMessage);
Serial.println("\nServidor ready... ");
}
void loop() {
server.handleClient();
delay(100);
}