Trouble getting Blynk application working with PlatformIO

Hardware I’m using: NodeMCU-32S

I’ve got a previously working Arduino/Blynk application on my ESP32 that I’m retooling to build with PlatformIO and porting to FreeRTOS. I ran into issues so I took a really simple Blynk example that I had working in the Arduino IDE and tried building it with PlatformIO to compare. It works fine with Arduino IDE but not with PlatformIO. Both environments are linking against Blynk 0.6.1.

My simple example app:

#define BLYNK_DEBUG
#define BLYNK_PRINT Serial

#include <esp_task_wdt.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

char auth[] = "[my auth]";
const char ssid[] = "[my ssid]";
const char pass[] = "[my password]";

void setup()
{
    esp_task_wdt_init(30000, false);

    // Debug console
    Serial.begin(115200);

    Blynk.begin(auth, ssid, pass);
}

void loop()
{
    Blynk.run();
}
framework = espidf, arduino
platform = espressif32
board = nodemcu-32s
monitor_speed = 115200
build_flags =
  -Wno-return-type
lib_deps=
  https://github.com/blynkkk/blynk-library

Console output with it connecting successfully (Arduino/Blynk 0.6.1):

14:05:59.874 -> [1136] IP: 192.168.1.19
14:05:59.907 -> [1136] 
14:05:59.907 ->     ___  __          __
14:05:59.940 ->    / _ )/ /_ _____  / /__
14:05:59.974 ->   / _  / / // / _ \/  '_/
14:06:00.011 ->  /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP32
14:06:00.044 -> 
[1209] Connecting to blynk-cloud.com:80
[2120] Ready (ping: 314ms).

Console output with it failing (PlatformIO/Blynk 0.6.1, plus Blynk debug messages enabled):

[2272] Connected to WiFi
[2272] IP: 192.168.1.19
[2272] 
	___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
		/___/ v0.6.1 on ESP32

[2278] Connecting to blynk-cloud.com:80
[2548] <[1D|00|01|00] [my auth]
[7550] Connecting to blynk-cloud.com:80
[7878] <[1D|00|01|00] [my auth]

It appears the request just never gets accepted in this case.

I’ve messed around with various Blynk options (changing the port to 8080, using the raw IP address instead of blynk-cloud.com, etc). But eventually compared to the Arduino build and I think it’s something about PlatformIO that I don’t understand.

Anyone have any experience with this? I’m pretty confused. PlatformIO seems awesome, I really want to switch over to it.

This forces usage of the bleeding-edge version of the library. Which library version does appear in the Arduino IDE library manager for the Blynk library?

Also in the Arduino IDE board manager, what version of the ESP32 platform is installed?

Same Blynk version. I don’t have it in front of me so not sure which ESP32 version the Arduino instance has — it’s likely a bit older. I can find out if it matters.

Ok, so I got it working. What I changed was I removed the espressif32 framework (leaving only the arduino framework). As this is my first venture into PlatformIO I don’t know what exactly that does. But now it’s working.

Any ideas why?

Ah yes, this line means “ESP-IDF, and with Arduino as a subcomponent”. It’s different to just the plain Arduino core, though it is meant to be arduino-compatible. Apparently here, something failed horribly.

I’d need to dig down really deep to find out what’s the issue, so maybe some time later? :sweat_smile: But great that it works this way.

1 Like