Reputation: 1
I am working on App and API for transferring data from bee-hive accessories. I have a database aprox. of 5000 records and I need to send them all to the app(10 records a message). The problem is that when I try to load the data, it might drop on LoadProhibited or not. It doesn't occur on the same record-stack. I might drop on any record stack(1 - 500). Also the error occurs somewhere between the code. If I add prints it will complete the method and then fall somewhere between the lines :). I tried to store buffer data in char* and stringstreams, both had the same results.
The method:
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
}
Reeboot log:
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
Thank you for your responses.
Upvotes: 0
Views: 65
Reputation: 1
My bad, after a few more hours, I discovered that I miss-typed value -> data.
And for those who also don't know how to debug exceptions on ESP in PIO.
Just add monitor_filters = esp32_exception_decoder
into platformio.ini
Upvotes: 0