ESP32 BLE传输大型数据库时出现LoadProhibited错误求助
问题:传输蜂箱配件数据时随机出现LoadProhibited错误
我正在开发一款用于传输蜂箱配件数据的App和配套API,数据库中有约5000条记录,需要按每包10条的方式全部发送到App。目前遇到的问题是:加载数据时会随机触发LoadProhibited错误,错误不固定出现在某一组记录(1-500组都可能触发)。而且错误是在代码执行过程中随机发生的——添加打印语句后方法能执行完成,但后续还是会出错。我试过用char*和stringstream存储缓冲数据,结果完全一样。
相关方法代码
void ConnectorBLE::SendRequestedData(std::string date_from, std::string date_to, int position) { Serial.print("Position: ");Serial.println(position); memset(char_buffer, 0, 600); int delay_time = (int)(20.0f * position + 160.5789f); if (position == 0) { int count = DatabaseHandler::GetRequestCount(date_from, date_to); // Get Count of packets std::string pcount = std::to_string(count); if (pcount.length() < 3) pcount = "0" + pcount; if (pcount.length() < 3) pcount = "0" + pcount; SendData(MakeCommand(RESPONSE_DATA, ("000" + pcount).c_str())); // Send Initial packet } else { std::string position_ = std::to_string(position); if (position_.length() < 3) position_ = "0" + position_; if (position_.length() < 3) position_ = "0" + position_; std::string respprefix = "2"; int state = DatabaseHandler::Select(date_from, date_to, position - 1, char_buffer); Serial.println("Sending data"); SendData_(respprefix + position_); // Send Data packet Serial.print("Free Heap: "); Serial.println(ESP.getFreeHeap()); } old_message_sent = true; //This point is OK }
重启日志
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled. Core 0 register dump: PC : 0x4009083c PS : 0x00060b30 A0 : 0x801c9619 A1 : 0x3ffdef20 A2 : 0x3ffef7e8 A3 : 0xbaad5678 A4 : 0x00000185 A5 : 0x3ffef7e8 A6 : 0x00000000 A7 : 0x00000018 A8 : 0x00000000 A9 : 0x3ffdeef0 A10 : 0x3ffef7e8 A11 : 0x00001800 A12 : 0x3ffef7e8 A13 : 0x00000001 A14 : 0x00000004 A15 : 0x3ffb6cb0 SAR : 0x0000000b EXCCAUSE: 0x0000001c EXCVADDR: 0xbaad5678 LBEG : 0x4009083c LEND : 0x40090852 LCOUNT : 0x00000017 Backtrace: 0x40090839:0x3ffdef20 0x401c9616:0x3ffdef30 0x401c96b5:0x3ffdef50 0x401c9744:0x3ffdef70 0x401c9ed5:0x3ffdef90 0x401c9ef9:0x3ffdefc0 0x400d1f61:0x3ffdefe0 0x401fffaf:0x3ffdf0a0 0x4011841a:0x3ffdf0c0 0x4011cc6d:0x3ffdf380 0x4011af45:0x3ffdf3a0 0x4011b331:0x3ffdf400 0x4011a74e:0x3ffdf420 0x40119089:0x3ffdf480 0x40130a9a:0x3ffdf4a0 0x401313ee:0x3ffdf4c0 0x40158a2d:0x3ffdf510 0x4015ab9f:0x3ffdf530 ELF file SHA256: 1b8e826616e53d75 Rebooting... ets Jul 29 2019 12:21:46 rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:1184 load:0x40078000,len:13104 load:0x40080400,len:3036 entry 0x400805e4
内容的提问来源于Stack Exchange,提问作者Filip Benda
相关产品推荐
相关产品推荐

