Can not compile on Arduino Nano ESP 32
-
Your board seems to use USBCDC to communicate with the PC. So in the file
/hal/architecture/ESP32/MyHwESP32.cpp, line 30, you have to changeMY_SERIALDEVICE.begin(MY_BAUD_RATE, SERIAL_8N1);toMY_SERIALDEVICE.begin(MY_BAUD_RATE);.
Furthermore, as ESP32 implements the functionsleep(uint32_t)iself, you need to change line 147 in the sketch fromsleep(SLEEP_TIME);tosleep(SLEEP_TIME, false);.Hope this helps!
Regards, Ei
-
As an additional info, sleep will not work on the ESP in version 2.3.2. Try the developement branch from the github if you need sleep, there I implemented this.
-
@ctodor of course:
https://github.com/mysensors/MySensors/tree/development does contain sleep code for ESP. You can download the library here as a zip file. -
@eiten
Sorry for the late response, but I didn't had time to work on it until today.Yes, I was able to compile but not to upload. After "uploading", the Arduino NANO ESP 32 disconects from the PC.
I must reset the board in order to be able to upload another sketch. -
OK, so I suppose the build flags are incorrect. Do you use PlatformIO? Then, you could try:
build_flags = -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=1If you are on the Arduino IDE, you have to set
Tools -> USB-Mode -> CDC-Mode. Ore something similar, I don't have the Arduino IDE installed ATM. IIRC, monitor speed must be set to 460800. -
OK, so I suppose the build flags are incorrect. Do you use PlatformIO? Then, you could try:
build_flags = -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=1If you are on the Arduino IDE, you have to set
Tools -> USB-Mode -> CDC-Mode. Ore something similar, I don't have the Arduino IDE installed ATM. IIRC, monitor speed must be set to 460800.@eiten Yep, I was able to upload the sketch after I've set Tools -> USB-Mode -> CDC-Mode.
Thank you for your help.Well, I think I rushed with the conclusion.
Somehow, the bord is now in infinite boot loop:0;255;3;0;14;Gateway startup complete.
0;255;0;0;18;2.3.2
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x8 (TG1WDT_SYS_RST),boot:0x2b (SPI_FAST_FLASH_BOOT)
Saved PC:0x4200d223
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a68
entry 0x403c98d4repetes over and over
-
That's strange. Is it exactly the code from above? It seems, it is in gateway mode, but in your sketch, you commented out the gateway option...
@eiten You are right. It is not the same sketch. The previuos sketch seems to work fine (I used it just to make sure I am able to compile and upload).
Now I'm trying to upload a sketch where the ardunio runs as gateway and this is what a need , a gateway that receives messages from a few magnetic door sensors.
But please, don't waste your time with me. I think I'm going to write my simple protocol to do such a simple task.Thank you very much for your effort.