ESP32 SPIFFS .... hard hard hard times

I have no idea how to switch between them. Moreover, I always found it very strange to find their tools buttons along side in bottom bar. In the beginning I thought it was something like a bug duplicating buttons of old and new versions.

image

When I start a new project in PlatformIO I’m asked to choose a framwork. I’ve always selected Arduino frameword. Is this the reason for having two ones on my desktop? Is ESP-IDF a permanent default, even when I choose Arduino?

Moreover, I don’t understand the reason for these two options, since Arduino always uses a huge directory of espressif’s files to handle ESP32. I’ve been choosing Arduino to try to keep close to what I’ve already done before. I thought it would make the migration easier.

These details look so complex for me. I’m electronics engineer, not software engineer. I use to make circuit projects with some microcontrollers handling the circuit functions, I/Os, math and comms. In the past I’ve been programming 8051, Z80 and Microchip PIC. When Microchip IDE became enormously confusing (V10, I think), my partner took responsibility for the software. Unfortunately he died of COVID recently. A couple of years ago I’ve started playing with Arduino and I found fantastic to have an environment where I could open a simple window, start writing a code and get it to work immediately.

Whatever, which framework would you recommend?

Thank you.
Regards

Me neither.

The point is that I’ve got many libraries with the same names in my hard drive. In Arduino IDE they used to work simply by calling #include <WiFi.h>, for example.

But, in VSCode environment not all of them don’t work. When I try to compile the code, there are lots of complains about missing functions or objects supposed to be in these libraries. So, my guess was that VSCode was taking the wrong libraries.

I myself didn’t know which ones should be picked. So, I’ve searched for all them in my hard drive and wrote down their complete paths in the code, so that I could try one by one until finding the right ones.

That’s why you’re seeing many repetitions of the same library name, but with different paths.

Good. So that’s why we do “read_flash 0x8000 0xc00”.

What do you mean by “Re”?

“pio” is PlatformIO, correct? You mean you do it with a blank PlatformIO project, right?

I’m trying again the command line:
“python /Particular/Projetos/espressif/esp32/tools/esptool.py -p /dev/cu.SLAB_USBtoUART read_flash 0x8000 0xC00 ptable.img”

and all I get now is this:
“$ python /Particular/Projetos/espressif/esp32/tools/esptool.py -p /dev/cu.SLAB_USBtoUART read_flash 0x8000 0xC00 ptable.img
esptool.py v3.2-dev
Serial port /dev/cu.SLAB_USBtoUART
Connecting…_
Detecting chip type… ESP32
Traceback (most recent call last):
File “/Particular/Projetos/espressif/esp32/tools/esptool.py”, line 4830, in
_main()
File “/Particular/Projetos/espressif/esp32/tools/esptool.py”, line 4823, in _main
main()
File “/Particular/Projetos/espressif/esp32/tools/esptool.py”, line 4291, in main
print(“Chip is %s” % (esp.get_chip_description()))
File “/Particular/Projetos/espressif/esp32/tools/esptool.py”, line 1542, in get_chip_description
pkg_version = self.get_pkg_version()
File “/Particular/Projetos/espressif/esp32/tools/esptool.py”, line 1518, in get_pkg_version
word3 = self.read_efuse(3)
File “/Particular/Projetos/espressif/esp32/tools/esptool.py”, line 1616, in read_efuse
return self.read_reg(self.EFUSE_RD_REG_BASE + (4 * n))
File “/Particular/Projetos/espressif/esp32/tools/esptool.py”, line 688, in read_reg
val, data = self.command(self.ESP_READ_REG, struct.pack(‘<I’, addr), timeout=timeout)
File “/Particular/Projetos/espressif/esp32/tools/esptool.py”, line 447, in command
p = self.read()
File “/Particular/Projetos/espressif/esp32/tools/esptool.py”, line 392, in read
return next(self._slip_reader)
File “/Particular/Projetos/espressif/esp32/tools/esptool.py”, line 3235, in slip_reader
trace_function(“Remaining data in serial buffer: %s”, HexFormatter(port.read(port.inWaiting())))
File “/Users/cirobruno/Library/Python/2.7/lib/python/site-packages/serial/serialposix.py”, line 501, in read
'device reports readiness to read but returned no data ’
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)”

Thank you, Max.
I’ve been trying, but there must be something missing in my configuration here.
Let me report the warnings I’ve received here:
“/Users/cirobruno/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c: In function ‘spiTransferBytesNL’:
/Users/cirobruno/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:922:39: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
uint8_t * last_out8 = &result[c_longs-1];
^
/Users/cirobruno/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:923:40: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
uint8_t * last_data8 = &last_data;
^”
and then
"Connecting…
Traceback (most recent call last):
File “/Users/cirobruno/.platformio/penv/lib/python3.8/site-packages/serial/serialposix.py”, line 500, in read
raise SerialException(
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Users/cirobruno/.platformio/packages/tool-esptoolpy/esptool.py”, line 4582, in
_main()
File “/Users/cirobruno/.platformio/packages/tool-esptoolpy/esptool.py”, line 4575, in _main
main()
File “/Users/cirobruno/.platformio/packages/tool-esptoolpy/esptool.py”, line 4074, in main
esp = esp or get_default_connected_device(ser_list, port=args.port, connect_attempts=args.connect_attempts,
File “/Users/cirobruno/.platformio/packages/tool-esptoolpy/esptool.py”, line 121, in get_default_connected_device
_esp.connect(before, connect_attempts)
File “/Users/cirobruno/.platformio/packages/tool-esptoolpy/esptool.py”, line 629, in connect
last_error = self._connect_attempt(mode=mode, esp32r0_delay=False, usb_jtag_serial=usb_jtag_serial)
File “/Users/cirobruno/.platformio/packages/tool-esptoolpy/esptool.py”, line 596, in _connect_attempt
self.sync()
File “/Users/cirobruno/.platformio/packages/tool-esptoolpy/esptool.py”, line 486, in sync
val, _ = self.command(self.ESP_SYNC, b’\x07\x07\x12\x20’ + 32 * b’\x55’,
File “/Users/cirobruno/.platformio/packages/tool-esptoolpy/esptool.py”, line 435, in command
p = self.read()
File “/Users/cirobruno/.platformio/packages/tool-esptoolpy/esptool.py”, line 380, in read
return next(self._slip_reader)
File “/Users/cirobruno/.platformio/packages/tool-esptoolpy/esptool.py”, line 3032, in slip_reader
trace_function(“Remaining data in serial buffer: %s”, HexFormatter(port.read(port.inWaiting())))
File “/Users/cirobruno/.platformio/penv/lib/python3.8/site-packages/serial/serialposix.py”, line 509, in read
raise SerialException(‘read failed: {}’.format(e))
serial.serialutil.SerialException: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
*** [upload] Error 1
============================================ [FAILED] Took 47.95 seconds ============================================"

I guess there’s some difficulty for finding the right port.
Where should I specify the port?

I see port is also a challenge itself. The serial monitor doesn’t “remember” the baud rate is always 115200 and sometimes it asks me to select which port within a list.

I see…

I hope so…

Dear @maxgerhardt and @ullix, thank you for all this support.
In Portuguese I’d describe my situation as “a fish out or water”.
But I’m gonna bet on your belief on VSCode and insist with it for my next step.

I’ve been using a functions test version of the application I must deliver. It’s meant to try all interfaces, such as comm buses (VSPI, HSPI), WiFi, Lora, OLED, SD Card, etc., in order to understand variables structures and so on. During this phase I use to define data structures, data sharing between functions and the program structure itself.

I guess I’m gonna jump some steps and start building the Version 1, starting by selecting the functions that will run in each core. Then I’m gonna create basic tasks and queues for each function.

I think this would be a good way to start writing it all over from scratch.
Please, could you help me?
Maybe it’s a good idea to open a new discussion, so that other beginners could follow.
Do you agree?

Thanks a lot.
Regards

Some suggestions:

If you don’t know whether to use framework Arduino or ESP-IDF you should ONLY use Arduino, and never look elsewhere!

You seem to have thoroughly messed up your installation. I suggest to uninstall and delete everything vscode and pio, and start over.

Use some starter tutorial for pio, and some simple examples to understand the workings of pio before approaching anything complex.

Don’t use any of the libs you may have somewhere on your hard drive; only install fresh via pio. If you have any self-made libs, study pio for how to integrate them into your projects.

“Re” in English is short for “referring”, “referencing”. Like “Re your memo from last week…”. Often automatically used in subject headers in email answers.

Your insertion of code as regular text makes it near impossible to read. Try using Blockquote and preformatted text:
Auswahl_001

Also, a backtick, like accent grave in French, is helpful for inline display of e.g. commands, file_names and such code related stuff.

Yes, I’m following.

I’ve just deleted everything, except the Espressif libraries inside Ardunino folder. I’ll need them to continue in Arduino IDE, if I don’t succeed here.

I’ve downloaded a fresh VSCode from:

following instructions from this guide:

Now I’m trying to follow

And I get:

I must say that since the first time I’ve tried to install VSCode I receive some error messages every step I go.

Should ignore and continue?

PowerShell solved