Having hard time using v2.3.4 in PlatformIO

I cannot seem to compile the latest version of SimpleFOC on PlatformIO:

.pio/libdeps/debug/ArduinoFOC/src/current_sense/hardware_specific/esp32/esp32_mcpwm_mcu.cpp:9:2: error: #error SimpleFOC: ESP-IDF version 4 or lower detected. Please update to ESP-IDF 5.x and Arduino-esp32 3.0 (or higher)

It seems this issue happened before (see here), and that it was resolved.

This time, however, things don’t look good. I don’t understand the problem fully, but there seems to be a conflict between PlatformIO and Espressif (see here).

So I’ve tried to replace the default Espressif 32 platform by the Tasmota fork:

platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.07.11/platform-espressif32.zip
framework = arduino

However, I get an odd include error:

.pio/libdeps/debug/ModifiedArduinoFOC/src/current_sense/hardware_specific/teensy/../../../drivers/hardware_specific/teensy/../../hardware_api.h:4:10: fatal error: ../common/foc_utils.h: No such file or directory

(despite the fact that …/common/foc_utils.h is there)

Has anyone experienced this?

Are you using the Arduino-esp32 v3.x version?

The v2.3.4 is now entirely built on the v3.x version of the arduino-esp32, hence the message.
It does no longer support the v2.x arduino-esp32.

I can’t, that’s the whole point :slight_smile:

In fact the Tasmota fork works, but only when SimpleFOC is put in the lib folder. As soon as it is included from the lib_deps section of the platformio.ini file, it doesn’t compile. It seems there’s a PlatformIO bug here. I will investigate and let you know.

I’ve had some weirdness with PlatformIO and existing projects…
But if you do a “Full Clean” or just re-create the project its working without issues for me.

To switch to the new framework version I have to force it in the platformio.ini like this:

[env:arduino_nano_esp32]
platform = espressif32
platform_packages=
  framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.3
  framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.3/esp32-arduino-libs-3.0.3.zip
board = arduino_nano_esp32

Then it compiled without issues.

1 Like

I’ve done a Full Clean, deleted the .pio folder, uninstalled/reinstalled PlatformIO, create a new project, but it didn’t solve the problem. I will now wait for what PlatformIO has to say about it.

My problem was due to the infamous “long paths” issue. In PlatformIO under Windows, any resolved absolute include path must be less than 260 characters long. So I had to move my project folder to the root of my drive, et voilà. See also here.

Back to the initial problem of using Arduino-esp32 v3.x under PlatformIO:

Espressif doesn’t support PlatformIO anymore, so we need to rely on unofficial ways.

The first solution, mentioned at the top of this thread, is to use the Tasmota fork:

platform = https://github.com/tasmota/platform-espressif32

There’s another fork, by the same guy:

platform = https://github.com/Jason2866/platform-espressif32

But those two forks have drawbacks: they are stripped versions, with missing features (for example there’s no BLE support), probably targeting specific projects with specific needs.

Then there’s the solution proposed above by @runger:

platform = espressif32
platform_packages=
  framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.3
  framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.3/esp32-arduino-libs-3.0.3.zip

It seems it works fine with framework = arduino, but I can’t seem to make it to work with framework = arduino, espidf.

And there’s a new solution, which I hope will be properly supported and maintained, as its goal is to become the generic PIO support for espressif32 (still unofficial, though):

platform = https://github.com/pioarduino/platform-espressif32

It’s done by the same guy mentioned above for the two specific forks. See more here.

Hi,

I’m getting an error when I tried to compile SimpeFoc V.2.3.4 with Esp32-arduino packages version 3.0.4 using PlatformIO.

[9/3/2024, 10:56:32 AM] For C++ source files, the cppStandard was changed from “gnu++23” to “gnu++20” based on compiler args and querying compilerPath: “/Users/charliechi/.platformio/packages/toolchain-xtensa-esp32s3/bin/xtensa-esp32s3-elf-gcc”

Below is my platformio.ini.

[env:esp32-s3-devkitc-1]

platform = espressif32

board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200

lib_deps =
askuric/Simple FOC@^2.3.4
SPI
Wire

I believe all the packages were installed correctly. Does anyone know how to fix the issue? Thanks.

@Charlie_Chi , I’m now using this without any problem:

[env]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip

Does it trigger the same problem?

(don’t forget to delete your .pio folder before recompiling)

1 Like

Yes, it works now. Thanks!

I have the same problem, your solution is correct, Thank you