Hello
I think I've been struggling with a problem for about a week now and I can't seem to solve it on my own and it's hard to find similar problems on the internet.... Namely, I want to communicate several ESP32 modules with each other using TCP/IP (one ESP is the server, the rest connect to it). Each ESP wants to differentiate by IP address and, depending on the address, put the incoming data into a specific variable. To read the IP address I use clien.remoteIP() - it returns the IP address, but if I call this function in a loop more than once my ESP gets a memory crash:
(message: Guru Meditation Error: Core 0 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x000000 PS : 0x00060e30 A0 : 0x801100ad A1 : 0x3ffb3d30
A2 : 0x3ffccd7c A3 : 0x3ffccfb0 A4 : 0x3ffcb340 A5 : 0x3ffcb320
A6 : 0x0204a8c0 A7 : 0x0c04a8c0 A8 : 0x8010ff50 A9 : 0x3ffb3cf0
A10 : 0x3ffccd8c A11 : 0x3ffccfb0 A12 : 0x3ffb3d3c A13 : 0x00000044
A14 : 0x00000001 A15 : 0x0000006 SAR : 0x00000010 EXCCAUSE: 0x00000014
EXCVADDR : 0x000000 LBEG : 0xx4000c349 LEND : 0xx4000c36b LCOUNT : 0x000000
Backtrace: 0x00000000:0x3ffb3d30 0x401100aa:0x3ffb3d70 0x4011d011:0x3ffb3d90 0x40122019:0x3ffb3dd0 0x401272b6:0x3ffb3df0 0x401109cf:0x3ffb3e10 0x40088b7d:0x3ffb3e40
I should add that the crash occurs just when trying to connect clients to ESP
If I connect the modules without recognition everything is fine - I'm able to send a series of data (admittedly it goes slow, several times slower than via UDP because I've already done the same thing using UDP) but recognition is necessary to properly segregate the data - let's assume each esp sends data from a different sensor - the server has to collect it and process it... When I call client.remoteIP() only once, the program works (although not always, sometimes requiring several client resets)
Would someone be so good as to advise or guide me at least on how to deal with this? Maybe there is an example available somewhere?
I am also attaching the server code:
.
and client code:
.
Regards
Added after 44 [minutes]:
Plus a screen shot of the ESP Exception Decoder:
I think I've been struggling with a problem for about a week now and I can't seem to solve it on my own and it's hard to find similar problems on the internet.... Namely, I want to communicate several ESP32 modules with each other using TCP/IP (one ESP is the server, the rest connect to it). Each ESP wants to differentiate by IP address and, depending on the address, put the incoming data into a specific variable. To read the IP address I use clien.remoteIP() - it returns the IP address, but if I call this function in a loop more than once my ESP gets a memory crash:
(message: Guru Meditation Error: Core 0 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x000000 PS : 0x00060e30 A0 : 0x801100ad A1 : 0x3ffb3d30
A2 : 0x3ffccd7c A3 : 0x3ffccfb0 A4 : 0x3ffcb340 A5 : 0x3ffcb320
A6 : 0x0204a8c0 A7 : 0x0c04a8c0 A8 : 0x8010ff50 A9 : 0x3ffb3cf0
A10 : 0x3ffccd8c A11 : 0x3ffccfb0 A12 : 0x3ffb3d3c A13 : 0x00000044
A14 : 0x00000001 A15 : 0x0000006 SAR : 0x00000010 EXCCAUSE: 0x00000014
EXCVADDR : 0x000000 LBEG : 0xx4000c349 LEND : 0xx4000c36b LCOUNT : 0x000000
Backtrace: 0x00000000:0x3ffb3d30 0x401100aa:0x3ffb3d70 0x4011d011:0x3ffb3d90 0x40122019:0x3ffb3dd0 0x401272b6:0x3ffb3df0 0x401109cf:0x3ffb3e10 0x40088b7d:0x3ffb3e40
I should add that the crash occurs just when trying to connect clients to ESP
If I connect the modules without recognition everything is fine - I'm able to send a series of data (admittedly it goes slow, several times slower than via UDP because I've already done the same thing using UDP) but recognition is necessary to properly segregate the data - let's assume each esp sends data from a different sensor - the server has to collect it and process it... When I call client.remoteIP() only once, the program works (although not always, sometimes requiring several client resets)
Would someone be so good as to advise or guide me at least on how to deal with this? Maybe there is an example available somewhere?
I am also attaching the server code:
Code: C / C++
and client code:
Code: C / C++
Regards
Added after 44 [minutes]:
Plus a screen shot of the ESP Exception Decoder: