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:

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

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

What’s your exact platformio.ini now?

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);
    digitalWrite(2, HIGH);

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