Problem upload code to ESP-01S

Hi,

I’m trying to upload a simple code to test my ESP-01S. I use the blink example in platformio and the board esp01_1m in platformio.ini. I upload it and looks right but, it doesn’t run. However, the same code uploaded to an ESP-01 chip and it runs correctly. In the same way if I upload the code through the Arduino IDE and with the configuration that I detail to my ESP-01S it works correctly.

Would this board need any special configuration in IDE platform (VSC)?

Blink code in Platformio

#include <Arduino.h>

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

void loop()
{
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

Content of platformio.ini

[env:esp01_1m]
platform = espressif8266
board = esp01_1m
framework = arduino
build_flags = -D LED_BUILTIN=2

Output upload task

Processing esp01_1m (platform: espressif8266; board: esp01_1m; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp01_1m.html
PLATFORM: Espressif 8266 > Espressif Generic ESP8266 ESP-01 1M
HARDWARE: ESP8266 80MHz 80KB RAM (1MB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 28 compatible libraries
Scanning dependencies...
No dependencies
Retrieving maximum program size .pioenvs\esp01_1m\firmware.elf
Checking size .pioenvs\esp01_1m\firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [===       ]  32.4% (used 26572 bytes from 81920 bytes)
PROGRAM: [===       ]  33.8% (used 257696 bytes from 761840 bytes)
Configuring upload protocol...
AVAILABLE: espota, esptool
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: COM7
Uploading .pioenvs\esp01_1m\firmware.bin
esptool.py v2.6
Serial port COM7
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: ec:fa:bc:ad:e7:e1
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Compressed 261856 bytes to 191270...
Wrote 261856 bytes (191270 compressed) at 0x00000000 in 16.9 seconds (effective 124.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Arduino IDE Code

#define LED 2

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

void loop() {
  digitalWrite(LED, HIGH);
  delay(1000);
  digitalWrite(LED, LOW);
  delay(1000);
}

Arduino output

esptool.py v2.6
2.6
esptool.py v2.6
Serial port COM7
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: ec:fa:bc:ad:e7:e1
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Flash params set to 0x0320
Compressed 261856 bytes to 191265...

Writing at 0x00000000... (8 %)
Writing at 0x00004000... (16 %)
Writing at 0x00008000... (25 %)
Writing at 0x0000c000... (33 %)
Writing at 0x00010000... (41 %)
Writing at 0x00014000... (50 %)
Writing at 0x00018000... (58 %)
Writing at 0x0001c000... (66 %)
Writing at 0x00020000... (75 %)
Writing at 0x00024000... (83 %)
Writing at 0x00028000... (91 %)
Writing at 0x0002c000... (100 %)
Wrote 261856 bytes (191265 compressed) at 0x00000000 in 16.9 seconds (effective 124.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Arduino settings
image

A couple of things spring to mind…

  • ESP8266s often need resetting after serial programming to boot up properly
  • Is pin 2 the built-in LED on BOTH boards?
  • The Flash mode in your Arduino IDE screenshot is set to DOUT, whereas the platformio default is QIO… see if setting board_build.flash_mode = dout makes any difference…

I have what I believe to be ESP01S’s … AFAIK the only real difference was they come with 1Mb of flash instead of 512k, and improvements to antenna performance? If so, I’ve been programming them with the default settings just fine, and interchanging them with the older 512k ESP01s… only difference being my ESP01Ss have their build-in LED on pin 2, not pin 2.

3 Likes

I feel very stupid, with the configuration board_build.flash_mode = dout has started to work correctly

Actually there are 3 different boards:

  • ESP-01 (512K) Blue board
  • ESP-01 (1Mb) Black board
  • ESP-01s (1Mb) Black board

image

Differents ESP-01 (512K) vs ESP-01 (1Mb)

  • Blue board (512k) vs Black board (1Mb)
  • Flash Memory 512K vs 1Mb

Differents ESP-01 (1Mb) vs ESP-01S (1Mb)

  • Red power LED vs -No- power LED
  • Blue LED on TX vs Blue LED on GPIO2 (low = on)
1 Like

lol… please don’t… save that for something worth it! :wink: :laughing:

Oh, nice… thank you… so it seems I’ve been working with the blue 'n black ESP-01s, not the ESP-01S… as the only real difference was board colour and flash size. Handy they don’t have the power led… no need to snip those off.

1 Like

I’ve been fighting this for days! Thanks!

Just to make this perfectly clear:
In your project, add the following line to platformio.ini:
board_build.flash_mode = dout

Then flash again, and things should work. It worked for me, at least.

4 Likes

Thank you for the answer to my problem as well.

1 Like

Very much thanks for this solution! It works! :cowboy_hat_face: