Apple Mac OS 14.4.1
Firefox 125.0.1
Arduino IDE 2.3.2
Arduino Nano ESP32
Arduino C++
AsyncUDP
I got my program to compile, and even load! The point is to prove I can communicate between microcontrollers using UDP. When one receives a packet, it responds by returning another packet to the source. Everything was fine until a little while after I turned on the second processor. It responded with a Guru Meditation Error: Core 0 panic'ed. (I presume this is when the two processors started to communicate.) What happened? Is this a problem with AsyncUDP?
(So far the verbose error codes, on upload, have not shown where the copy of AsyncUDP.h IDE is using is.)
(There are three more truly inconsequential sections I'm leaving out. Everything interesting is below.)
//client/main
#include <WiFi.h>
#include <AsyncUDP.h>
#include <UniversalTimer.h>
#include <arduino_secrets.h>
#define LED_BUILTIN 2 // The built-in LED is connected to pin 2
//const char ssid[] = "ABCD";
//const char password[] = "123456";
UniversalTimer WiFi_transmit_start(5000, false);
UniversalTimer WiFi_transmit_delay(2000, false);
UniversalTimer blink_on(250, false);
IPAddress ip(192, 168, 1, 143);
IPAddress remoteIP(192, 168, 1, 54);
uint16_t IPport = 57400;
uint8_t sensorValue;
uint32_t remote_IP;
uint8_t data_in = 0;
uint8_t data_out = 0;
void read_incoming();
void write_outgoing();
//WiFiClass WiFi;
AsyncUDP udp;
AsyncUDPPacket *packet;
void setup() {
Serial.begin(115200);
delay(2000);
// Set ADC resolution (optional)
analogReadResolution(8); // 8-bit resolution
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
//listen(const IPAddress addr, uint16_t port)
udp.listen(ip, IPport);
udp.onPacket([](AsyncUDPPacket packet) {
read_incoming();
Serial.println("end of lambda");
}); //udp.onPacket([](AsyncUDPPacket packet)
WiFi_transmit_delay.start();
Serial.println("end of setup()");
delay(10);
} //void setup()
void loop() {
//Serial.println("start loop()");
//this ensures somebody starts transmitting
if (!WiFi_transmit_start.isRunning()) WiFi_transmit_start.start();
//Serial.print("UniversalTimer = ");
//Serial.println(WiFi_transmit_start.getTimerValue());
//.check() indicates timeout has expired
if (WiFi_transmit_delay.check() | WiFi_transmit_start.check()) {
Serial.println("pre-write_outgoing()");
//returns data_out
write_outgoing();
//size_t write(uint8_t): Writes a single byte to the current packet.
//udp.writeTo((uint8_t *)message, strlen(message), remoteIp, remotePort)
udp.writeTo(&data_out, 1, remoteIP, IPport);
WiFi_transmit_delay.resetTimerValue();
WiFi_transmit_start.resetTimerValue();
data_out = 0;
//udp.flush(); //Stops the UDP connection and cleans up resources.
} //if (WiFi_transmit_delay.check() | WiFi_transmit_start.check())
//Serial.println("pre-blink()");
//blink();
data_in = 0;
//Serial.println("end of loop()");
} //void loop()
15:38:36.395 -> pre-write_outgoing()
15:38:36.395 -> data_out = 121
15:38:41.386 -> pre-write_outgoing()
15:38:41.386 -> data_out = 168
15:38:46.393 -> pre-write_outgoing()
15:38:46.393 -> data_out = 236
15:38:51.120 -> Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
15:38:51.121 ->
15:38:51.121 -> Core 0 register dump:
15:38:51.121 -> PC : 0x400d286e PS : 0x00060330 A0 : 0x800d29c7 A1 : 0x3ffcdaf0
15:38:51.121 -> A2 : 0x3ffc3b28 A3 : 0x3ffcdbcc A4 : 0x3ffcdf28 A5 : 0x0000e038
15:38:51.155 -> A6 : 0x9cdf29b3 A7 : 0x00000000 A8 : 0x800d2869 A9 : 0x3ffcdad0
15:38:51.155 -> A10 : 0x00000000 A11 : 0x3ffcdc24 A12 : 0x00000004 A13 : 0x3ffcdb84
15:38:51.155 -> A14 : 0x9cdf29b3 A15 : 0x00000000 SAR : 0x00000000 EXCCAUSE: 0x0000001c
15:38:51.155 -> EXCVADDR: 0x00000000 LBEG : 0x400898b8 LEND : 0x400898ce LCOUNT : 0xffffffff
15:38:51.186 ->
15:38:51.186 ->
15:38:51.186 -> Backtrace: 0x400d286b:0x3ffcdaf0 0x400d29c4:0x3ffcdb20 0x400d3f99:0x3ffcdbb0 0x400d3fea:0x3ffcdc50
15:38:51.186 ->
15:38:51.186 ->
15:38:51.186 ->
15:38:51.186 ->
15:38:51.186 -> ELF file SHA256: c4c651b5651fd826
15:38:51.186 ->
15:38:51.449 -> Rebooting...
15:38:51.449 -> ets Jul 29 2019 12:21:46
15:38:51.449 ->
15:38:51.449 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
15:38:51.449 -> configsip: 0, SPIWP:0xee
15:38:51.449 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
15:38:51.449 -> mode:DIO, clock div:1
15:38:51.449 -> load:0x3fff0030,len:1344
15:38:51.449 -> load:0x40078000,len:13964
15:38:51.449 -> load:0x40080400,len:3600
15:38:51.449 -> entry 0x400805f0
15:38:53.815 -> end of setup()
15:38:55.818 -> pre-write_outgoing()
15:38:55.818 -> data_out = 123
15:38:56.114 -> Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
15:38:56.146 ->
15:38:56.146 -> Core 0 register dump:
15:38:56.146 -> PC : 0x400d286e PS : 0x00060330 A0 : 0x800d29c7 A1 : 0x3ffcdaf0
15:38:56.146 -> A2 : 0x3ffc3b28 A3 : 0x3ffcdbcc A4 : 0x3ffcdec8 A5 : 0x0000e038
15:38:56.146 -> A6 : 0x9cdf29b3 A7 : 0x00000000 A8 : 0x800d2869 A9 : 0x3ffcdad0
15:38:56.146 -> A10 : 0x00000000 A11 : 0x3ffcdc24 A12 : 0x00000004 A13 : 0x3ffcdb84
15:38:56.178 -> A14 : 0x9cdf29b3 A15 : 0x00000000 SAR : 0x00000000 EXCCAUSE: 0x0000001c
15:38:56.178 -> EXCVADDR: 0x00000000 LBEG : 0x400898b8 LEND : 0x400898ce LCOUNT : 0xffffffff
15:38:56.178 ->
15:38:56.178 ->
15:38:56.178 -> Backtrace: 0x400d286b:0x3ffcdaf0 0x400d29c4:0x3ffcdb20 0x400d3f99:0x3ffcdbb0 0x400d3fea:0x3ffcdc50
15:38:56.178 ->
15:38:56.178 ->
15:38:56.178 ->
15:38:56.178 ->
15:38:56.178 -> ELF file SHA256: c4c651b5651fd826
15:38:56.178 ->
15:38:56.441 -> Rebooting...
15:38:56.441 -> ets Jul 29 2019 12:21:46
15:38:56.441 ->
15:38:56.441 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
15:38:56.441 -> configsip: 0, SPIWP:0xee
15:38:56.441 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
15:38:56.472 -> mode:DIO, clock div:1
15:38:56.473 -> load:0x3fff0030,len:1344
15:38:56.473 -> load:0x40078000,len:13964
15:38:56.473 -> load:0x40080400,len:3600
15:38:56.473 -> entry 0x400805f0
15:38:58.843 -> end of setup()
15:39:00.819 -> pre-write_outgoing()
15:39:00.819 -> data_out = 123
15:39:01.081 -> Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
15:39:01.081 ->
15:39:01.081 -> Core 0 register dump:
15:39:01.081 -> PC : 0x400d286e PS : 0x00060330 A0 : 0x800d29c7 A1 : 0x3ffcdaf0
15:39:01.081 -> A2 : 0x3ffc3b28 A3 : 0x3ffcdbcc A4 : 0x3ffce270 A5 : 0x0000e038
15:39:01.081 -> A6 : 0x9cdf29b3 A7 : 0x00000000 A8 : 0x800d2869 A9 : 0x3ffcdad0
15:39:01.113 -> A10 : 0x00000000 A11 : 0x3ffcdc24 A12 : 0x00000004 A13 : 0x3ffcdb84
15:39:01.113 -> A14 : 0x9cdf29b3 A15 : 0x00000000 SAR : 0x00000000 EXCCAUSE: 0x0000001c
15:39:01.113 -> EXCVADDR: 0x00000000 LBEG : 0x400898b8 LEND : 0x400898ce LCOUNT : 0xffffffff
15:39:01.113 ->
15:39:01.113 ->
15:39:01.113 -> Backtrace: 0x400d286b:0x3ffcdaf0 0x400d29c4:0x3ffcdb20 0x400d3f99:0x3ffcdbb0 0x400d3fea:0x3ffcdc50
15:39:01.146 ->
15:39:01.146 ->