Program behavior differs between ArduinoIDE and PlatformIO

I started using Platform IO yesterday. I tried to run a program that was confirmed to behave properly in the Arduino IDE with Platform IO, but it did not work, so I looked at the serial monitor and found that after an interrupt event, the string “esp now not init!” is output, followed by a garbled string. After the interrupt event occurred, the string "esp now not init! The only library loaded is 【M5StickCPlus】, and the versions are the same in both environments. What are the possible causes?

The string “esp now not init!” appears only on the Platform IO side, which is not behaving properly, so I am thinking that the “esp_now.h” file included in the program is different from the one referenced in the Arduino IDE. However, I don’t know where this file is located, and I was wondering if anyone knows how to find it?

If the library is the same version, is the used Arduino-ESP32 core version also the same? What does Tools → Boards → Board Manager → eps32 in the Arduino say in regards to ESP32?

1 Like

Thank you for your replying!
It says 【version 1.0.6】.

In platformIO, it seems that the board manager can be opened from the [Boards] tab in PIO Home, but there does not seem to be a board called ESP32 in this tab. (No hits in the search).
Instead, in the 【Installed】 section of the 【Platform】 tab, there is a similar board called 【Espressif 32】, but it has a different name and a version of 【6.4.0】, which is a higher number than the ESP32 board in the Arduino IDE.

This is really old. If you’re using the latest Epsressif32 platform version, you get Arduino-ESP32 v2.0.11.

If you wish to make PlatformIO use Arduino-ESP32 1.0.6, you have to say

platform = espressif32@3.5.0

in the platformio.ini.

It would be a better approach to make the sketch Arduino-ESP32 2.0.x compatible.

Specifically, it seems very weird to me that ESP-NOW is accessed inside an ISR.

Thank you for your response!
Uh… But the version of ESP32 has to be 1.0.6… when I set the version to 2.0 series during Arduino IDE development, I got an error, so I intentionally dropped the version to make it stable.

In the answer, it says to write “platform = espressif32@3.5.0” if you want PlatformIO to use ESP32 1.0.6 of the Arduino IDE.
Is there somewhere a version compatibility chart between the Arduino IDE’s ESP32 and PlatformIO’s Espressif 32 boards?
I would like to understand this properly.

Huh? PlatformIO is just an alternative build system compared to PlatformIO. It uses the same Arduino-ESP32 core files. Everything that can be done in the Arduino IDE can be done in PlatformIO too. The used versions of the Arduino-ESP32 core for a certain Espressif32 platform version can be looked up per release notes.

By writing 【platform=espressif32@3.5.0】 in platform.ini as you advised, I was able to confirm normal operation during Arduino IDE development, which was my goal.
Thank you very much for your help.

I am sorry to ask this question again.
I am such a beginner that I missed the fact that Arduino IDE and PlatformIO are two different build systems, but I would like to improve my level as a developer in the future.

What process did you go through (specifically what information did you look at) to know that the Arduino IDE and PlatformIO, each tool uses the same Espressif Github provided library (I don’t know if you call it a library) for the ESP32? Were you able to do that?