ESP32 board support

How can I use ESP32 with XOD?

Try to add the https://dl.espressif.com/dl/package_esp32_index.json URL to:

C:\Users\You\xod\__packages__\extra.txt

Then restart IDE and hit Deploy → Upload to Arduino → Refresh boards list

1 Like

Thx a lott!
Before restarting IDE we shall manualy download json file to packages dir. Otherwise there will be an error.

2 Likes

Ah made a mistake to open the subject, I answer here.
The compilation error can be due to an error when selecting the pin, for the configuration with correct see pins_arduino.h
C:\Users*User*\Documents\Arduino\hardware\espressif\esp32\variants\ ( you board)

Example: LED_BUILTIN = 2 , declare D2

    if (!isValidDigitalPort(port)) {
        emitValue<output_ERR>(ctx, 1);
        return;
    }

If the port is not correct, it returns error

error: ‘::analogWrite’ has not been declared
::analogWrite(port, val);
^

it may be the correct pin

Hi.
I make static port to 2 in pwm-write:

::pinMode(port, OUTPUT);
::analogWrite(2, val);
emitValue<output_DONE>(ctx, 1);

And have same error:

C:\Temp\xod_temp_sketchbook2a0njU\xod_1544168735833_sketch\xod_1544168735833_sketch.ino: In function ‘void xod::xod__gpio__pwm_write::evaluate(xod::xod__gpio__pwm_write::Context)’:
C:\Temp\xod_temp_sketchbook2a0njU\xod_1544168735833_sketch\xod_1544168735833_sketch.ino:1108:5: error: ‘::analogWrite’ has not been declared
::analogWrite(2, val);
^

Error: exit status 1
Compilation failed.

Now i think maybe mistake that this is not analog port? Because there is no analog ports on ESP32.

Now I create clean patch. Error on upload:

Uploading compiled code to the board…
No new serial port detected.

usage: esptool write_flash [-h] [–flash_freq {keep,40m,26m,20m,80m}]
[–flash_mode {keep,qio,qout,dio,dout}]
[–flash_size FLASH_SIZE]
[–spi-connection SPI_CONNECTION] [–no-progress]
[–verify] [–compress | --no-compress]
[ …]
esptool write_flash: error: argument : [Errno 2] No such file or directory: ‘C:\Temp\xod_temp_sketchbook2a0njU\xod_1544169358487_sketch/xod_1544169358487_sketch.esp32.esp32.esp32.partitions.bin’

Error: exit status 2
Error during upload.
Upload failed
Command C:\Program Files\XOD IDE\resources\arduino-cli.exe --config-file=C:\Temp\arduino-cliFDxphp\.cli-config.yml upload --fqbn esp32:esp32:esp32:UploadSpeed=115200 --port COM13 --verbose -t C:\Temp\xod_temp_sketchbook2a0njU\xod_1544169358487_sketch failed with code 1
Make sure the board is connected, the cable is working, the board model set correctly, the upload port belongs to the board, the board drivers are installed, the upload options (if any) match your board specs.

you must change the port in the node inspector., do not need to change the C ++ code

the vast majority of the pins are analog-digital

Change the speed to 921600, it could also be that XOD is not compatible

Hi gilyazov
I have been looking into the ESP32 for a while now and I have tried a lot of different things. Zod can compile the code perfectly fine but it seems to have issues uploading still. If you export the code into the Arduino IDE and compile and upload you should have less problems. That said some of the code that is used in incorporating external libraries into Zod does not seem to be compatible with the ESP32 compiler.
The ESP32 libraries for Arduino are still very young and a lot of not been implemented yet.

Last I programmed ESP32 in Arduino IDE it’s core does not have a simple analogWrite(port,data) since it has I believe TWO different ways to emit an “analogue” signal on most pins as well as a pair of true DACs on two fixed pins. To use standard Arduino analogWrite() you’d need to create a library that emulates it using the most suitable PWM generation mode assuming you want PWM and not an actual DAC generated analogue voltage which an ESP32 can also produce!
MCPWM is used to generate PWM for PWM controlled servo motors I believe that is accessed using sigmadelta prefixed functions.
LED_PWM is used to adjust LED brightness 8 high speed PWM channels and 8 low speed PWM channels
using ledc prefixed functions.
and DAC a pair of 8 bit digital to analogue converters fixed to two pins the PWM generators can be assigned to most of the GPIO pins.
Because of the added functionality I suspect it was not deemed smart to try and force all Arduino IDE users to use a very restricted emulation of analogWrite() when the chip can do so much more.
In the Arduino IDE with one of the ESP32 toolchains selected go into the Examples and look in the subfolder ESP32 and in the further subfolder AnalogOut for a some examples of LED_PWM and MCPWM using sigmadelta functions

I’ll read a little more about ESP32. Thanks :+1:

I have the same problem with ESP32
esptool write_flash: error is this a problem with ESPTOOL? I do not have an idea anymore. The arduino IDE sketch works but XOD is much easier for me. I hope that the problem will be solved quickly