Esp8266 gibberish serial monitor output

Hey all!

I’ve been using PlatformIO for quite a while and everything worked fine. Yesterday, I tried some dummy code and uploaded it using ArduinoIDE, opened the serial monitor and it showed the output as expected. When I tried converting the project to PlatformIO instead, the serial monitor showed gibberish letters, also, when tried viewing the serial monitor again in Arduino IDE, it again, showed gibberish letters.

Tried uploading the same code again from ArduinoIDE and the issue was resolved, but when uploaded again using PlatformIO, again, the same issue remained.

Here’s my platformio.ini file:

[env:esp8266]
platform = espressif8266
board = esp01_1m
framework = arduino
monitor_speed = 9600

main.cpp

#include <Arduino.h>

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  while(true) {
    Serial.println("...");
    delay(1000);
  }
}

Tried looking at other answers on this forum and tried also the clean command.

Any ideas?

Thanks!

Seeing gibberish on boot is perfectly normal since the ESP8266’s bootloader outputs stuff at a fixed 74880 baud. After that, it executes your firmware and prints out stuff at 9600 baud. So, initial output will be garbage.

You can see that yourself when you adjust your firmware’s baud and platformio.ini to 74880.

The Arduino IDE hides this initial bootloader output from you. PlatformIO does not.

I see gibberish on boot, but it doesn’t show me my Serial.println("...") output afterwards.

Then your firmware wasn’t booted properly, likely because of wrong platformio.ini settings.

What is the bootloader output? (Change to monitor_speed = 74880)

Can you show a screenshot of the Arduino IDE → Tools menu with which your board works?

Edit: Looking into monitor_speed = 74880 now.

Looking at esp01_1m.json, it uses Qio as its flash mode. The documentation shows you all configuration options, so let’s equalize them.

Does your firmware work when you use

[env:esp8266]
platform = espressif8266
board = esp01_1m
framework = arduino
monitor_speed = 9600
board_build.flash_mode = dout
upload_resetmethod = nodemcu
1 Like

This is the error I get when using monitor_speed = 74880:

Yes! This worked perfectly! Thank you very much! :pray:

One thing that still remains a big question mark for me is that these exact settings that I’ve used are being used in another project I have, and they work fine with the same ESP.