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.

4 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:

3ffffd70: 00002000 91b25ff6 00002000 00008000
3ffffd80: 00000002 00000000 00002000 00000000
3ffffd90: 00008000 00000000 00000010 00000000
3ffffda0: a1cfa8c9 f77fa69f 40001e65 3ffffdf5
3ffffdb0: 3ffffe70 00000004 00000000 40001e4b
3ffffdc0: 3ffffdf4 00000000 00000000 00000000
3ffffdd0: 166d80d2 00000000 00001000 5a092d3e
3ffffde0: 00008000 00000000 0000000a 00000000
3ffffdf0: 31656430 00000034 40001e65 3ffffe42
3ffffe00: 3ffffec0 00000002 5b9f0507 40001e4b
3ffffe10: 3ffffe41 00000000 00000000 00000000
3ffffe20: 00006000 b6d95529 00006000 0000a000
3ffffe30: 1653df75 00000000 00006000 8395f1ed
3ffffe40: 3fffd848 40002364 00000001 00000000
3ffffe50: 40001db4 00000078 00000000 00000010
3ffffe60: 40001f46 00000009 ee1e4429 40001e4b
3ffffe70: 40001db4 00000030 00000000 00000000
3ffffe80: 40001f46 00000002 9fd3cd8f bca3d4af
3ffffe90: 3fffd848 40002364 00000007 00000000
3ffffea0: 40001db4 00000078 00000000 00000010
3ffffeb0: 00000000 3fffff20 3fffff20 3fff20be
3ffffec0: 40002514 3fffdd3c 00000002 3fffffb0
3ffffed0: 3fffe710 3fffff40 3fffff40 3fff20c6
3ffffee0: 40002514 3fffdd3c 00000000 3fffffb0
3ffffef0: 3fffe710 40002394 00000004 ffffffff
3fffff00: 00000000 400042db 00000000 3ffffe90
3fffff10: 40004b31 00041aef bff00000 0000bfff
3fffff20: 4010f175 3fffff40 00000004 4010f509
3fffff30: 3ffe8610 000003d8 200005e9 401000c0
3fffff40: 3fff20c3 00018000 60001280 3fffe710
3fffff50: 3fffffb0 00000000 00000009 4010f50e
3fffff60: 2e9c10c1 ffffffff 00000000 2c306ffd
3fffff70: f0cf1310 50baabe6 ef31fa62 0498d8db
3fffff80: 31d976f4 b0f9eb18 39ccd01b 7bce1776
3fffff90: a2382e36 223a0a87 f3615241 5915dbb6
3fffffa0: abe623a7 c15223ff 28b7209e 45713535
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

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

load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v00041ed0
~ld

How to solve this?

Too little information to answer your question. A stack trace does not help without having the code.

Please kindly provide more information like kntsoft did in the first post in this thread. Also use the exception decoder to get detailed information about where the crash happened in your code.