PlatformIO Community

Code compiles and uploads but does not run

I have a small program that I’ve converted from an Arduino Sketch. Using CLion and PlatfromIO with an ESP01-S (ESP8266).

If I compile the code with Arduino IDe, it uploads and works fine. Using CLion/PlatformIO the code builds and uploads fine but doesn’t appear to run. The serial monitor just displays an initial line of random characters, the same as when running via Arduino IDE

I have uploaded the code and build log here: https://gist.github.com/dlintott/437b9aaa577c61bda820d408f4d7b6de

Any ideas?

Can you screenshot your Arduino IDE settings?

Also which ESP8266 package version are you running in the Arduion IDE?

Can you switch the baud rate of your serial monitor to 74880 (e.g. by using monitor_speed = 74880 in the platformio.ini) and post the output being sent after resetting the board? The bootloader outputs at this speed and might indicate a startup failure.

1 Like

Arduino IDE Settings

It looks like the Arduino IDE is using version 2.6.3 of the ESP8266 Core.

Output from bootloader is as follows:

ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1392, room 16 
tail 0
chksum 0xd0
csum 0xd0
v3d128e5c
~ld

I also added board_build.flash_mode = dout to platformio.ini as per the thread here: Problem upload code to ESP-01S

What’s your exact platformio.ini now?

[env:esp01_1m]
platform = espressif8266
board = esp01_1m
framework = arduino
board_build.flash_mode = dout
monitor_speed = 74880

WIth this configuration, does a simpler example work? Like blink on a fixed GPIO pin with an LED?

It does indeed, the below code works just fine.

#include <Arduino.h>

void setup() {
    pinMode(2, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
    digitalWrite(2, LOW);
    delay(1000);
    digitalWrite(2, HIGH);
    delay(1000);
}

So after getting the LED to blink, I’ve put back in the original code and it appears to compile fine now… Not sure what has changed, but’s now working

1 Like