完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我是 arduino ide 和这些代码的新手,试图将我的 nodemcu esp-12e 用作 coap 客户端,但我不断收到异常 28 错误,我不知道是什么原因造成的,这是一个学校项目,我似乎不能为了取得任何进展,如果我能得到任何帮助,我将不胜感激,在此先感谢。
异常 28:LoadProhibited:A load referenced a page mapped with an attribute that doesn\'t loads PC: 0x4000bf80 EXCVADDR: 0x0000008c 解码堆栈结果 0x402019e0: coapClient::send(IPAddress, int, char*, COAP_TYPE, COAP_METHOD, unsigned char*, unsigned char, unsigned char*, unsigned int, unsigned char, unsigned char) 在 C:\\Users\\ugur_\\OneDrive\\Belgeler\\Arduino\\libraries\\ESP-CoAP-master\\coap_client.cpp 第 81 行 0x40100100: ets_intr_lock() 在 C:\\Users\\ugur_\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.0\\cores\\esp8266\\core_esp8266_main.cpp 第 159 行 0x402035e6: uart_tx_fifo_available(int ) 在 C: \\ Users\\ugur_\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.0\\cores\\esp8266\\uart.cpp line 499 0x40203670: uart_do_write_char(int, char) 在 C:\\Users\\ugur_\\AppData\\Local \\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.0\\cores\\esp8266\\uart.cpp line 512 0x40201ea8: HardwareSerial::write(unsigned char) 在 C:\\Users\\ugur_\\AppData\\Local\\Arduino15\\packages\\ esp8266\\hardware\\esp8266\\3.0.0\\cores\\esp8266/HardwareSerial.h 第 189 行 0x40201a70:coapClient::loop() 在 C:\\Users\\ugur_\\OneDrive\\Belgeler\\Arduino\\libraries\\ESP-CoAP-master\\coap_client .cpp 第 191 行 0x4020825b: rand at /workdir/repo/newlib/newlib/libc/stdlib/rand.c line 79 0x40201a3c: coapClient::get(IPAddress, int, char*) at C:\\Users\\ugur_\\OneDrive\\Belgeler\\Arduino\\ libraries\\ESP-CoAP-master\\coap_client.cpp line 29 0x401008cc: malloc(size_t) 在 C:\\Users\\ugur_\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.0\\cores\\esp8266\\umm_malloc \\umm_malloc.cpp 行 821 0x40100274: pvPortMalloc(size_t, char const*, int) 在 C:\\Users\\ugur_\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.0\\cores\\esp8266\\umm_malloc/ umm_heap_select.h 第 85 行 0x40201a70:coapClient::loop() 在 C:\\Users\\ugur_\\OneDrive\\Belgeler\\Arduino\\libraries\\ESP-CoAP-master\\coap_client.cpp 第 191 行 0x402021f8: Print::println() 在 C:\\Users\\ugur_\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.0\\cores\\esp8266/Print.h 第 57 行 0x402017c7: coapClient::start ( ) 在 C:\\Users\\ugur_\\OneDrive\\Belgeler\\Arduino\\libraries\\ESP-CoAP-master\\coap_client.cpp 第 24 行 0x4020118a: setup() 在 C:\\Users\\ ugur_\\AppData\\Local\\Temp\\arduino_modified_sketch_968430/coapclient .ino 第 66 行 0x40202934:loop_wrapper() 在 C:\\Users\\ugur_\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.0\\cores\\esp8266\\core_esp8266_main.cpp 第 198 行 代码:全选/* ESP-COAP Client */ #include #include \"coap_client.h\" //instance for coapclient coapClient coap; //WiFi connection info const char* ssid = \"tt12\"; const char* password = \"12345\"; //ip address and default port of coap server in which your interested in IPAddress ip(127,0,0,1);//take ETH Zurich or coap.me server to run and check client int port =5683; // coap client response callback void callback_response(coapPacket &packet, IPAddress ip, int port); // coap client response callback void callback_response(coapPacket &packet, IPAddress ip, int port) { char p[packet.payloadlen + 1]; memcpy(p, packet.payload, packet.payloadlen); p[packet.payloadlen] = NULL; //response from coap server if(packet.type==3 && packet.code==0){ Serial.println(\"ping ok\"); } Serial.println(p); } void setup() { Serial.begin(115200); WiFi.begin(ssid, password); Serial.println(\" \"); // Connection info to WiFi network Serial.println(); Serial.println(); Serial.print(\"Connecting to \"); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { //delay(500); yield(); Serial.print(\".\"); } Serial.println(\"\"); Serial.println(\"WiFi connected\"); // Print the IP address of client Serial.println(WiFi.localIP()); // client response callback. // this endpoint is single callback. coap.response(callback_response); // start coap client coap.start(); //get request to server (arguments ip adrress of server,default port,resource(uri)) int msgid = coap.get(ip,port,\"light\"); //observe request (arguments ip adrress of server,deafult port,resource name,interger(0) ) //int msgid= coap.observe(ip,port,\"light\",0); //reset observe cancel //int msgid=coap.observecancel(ip,port,\"resoucename\"); } //int i=0; void loop() { bool state; // Requests //get request //int msgid = coap.get(ip,port,\"hello\"); //put request //arguments server ip address,default port,resource name, payload,payloadlength //int msgid =coap.put(ip,port,\"resourcename\",\"0\",strlen(\"0\")); //post request //arguments server ip address,default port,resource name, payload,payloadlength //int msgid =coap.post(ip,port,\"resourcename\",\"0\",strlen(\"0\")); //delete request //int msgid = coap.delet(ip,port,\"resourcename\"); //ping //int msgid=coap.ping(ip,port); // int msgid=coap.observe(ip,port,\"obs\",0); state= coap.loop(); // Serial.print(\"state=\"); //Serial.println(state); //if(state==true) //i=i+1; //Serial.print(\"i=\"); //Serial.println(i); //if(i==3) //{ //Serial.println(\"cancel observe\"); //coap.observeCancel(ip,port,\"resourcename\"); //} //Serial.println(msgid); delay(1000); } |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
1123 浏览 1 评论
574浏览 6评论
477浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
461浏览 5评论
462浏览 4评论
435浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-20 20:08 , Processed in 0.779634 second(s), Total 76, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号