Post topics, source code that relate to the Arduino Platform
User avatar
By perigalacticon
#72389 I am trying to program 4 esp-01 modules I recently received.

I am currently able to program 2 Esp01s that I have been using for several months, however I am unable to program the new Esp01s with the same programming hardware.

I have tried almost every setting combination in the IDE under Generic ESP8266 Module , but the error is always:

Code: Select allerror: espcomm_upload_mem failed


this is the output from the debug window:
Code: Select allWARNING: Category 'Sensor' in library Adafruit_VL53L0X is not valid. Setting to 'Uncategorized'
Build options changed, rebuilding all
Archiving built core (caching) in: C:\Users\PERIGA~1\AppData\Local\Temp\arduino_cache_569886\core\core_esp8266_esp8266_generic_CpuFrequency_80,FlashFreq_40,FlashMode_qio,UploadSpeed_115200,FlashSize_1M64,ResetMethod_ck,Debug_Disabled,DebugLevel_None_____82358c2f9e86d376ed80024bea7f0df4.a
Sketch uses 248159 bytes (25%) of program storage space. Maximum is 958448 bytes.
Global variables use 33468 bytes (40%) of dynamic memory, leaving 48452 bytes for local variables. Maximum is 81920 bytes.
C:\Users\Perigalacticon\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.9/esptool.exe -vv -cd ck -cb 115200 -cp COM4 -ca 0x00000 -cf C:\Users\PERIGA~1\AppData\Local\Temp\arduino_build_98219/christmas_outdoor_display_ESP-01_1.ino.bin
esptool v0.4.9 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
   setting board to ck
   setting baudrate from 115200 to 115200
   setting port from COM1 to COM4
   setting address from 0x00000000 to 0x00000000
   espcomm_upload_file
   espcomm_upload_mem
   setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2013 bytes of data
   read 0, requested 1
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
trying to connect
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2013 bytes of data
   read 0, requested 1
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
trying to connect
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2013 bytes of data
   read 0, requested 1
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
resetting board
trying to connect
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2013 bytes of data
   read 0, requested 1
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
trying to connect
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2013 bytes of data
   read 0, requested 1
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
trying to connect
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2013 bytes of data
   read 0, requested 1
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
resetting board
trying to connect
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2013 bytes of data
   read 0, requested 1
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
trying to connect
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2013 bytes of data
   read 0, requested 1
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
trying to connect
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2013 bytes of data
   read 0, requested 1
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed


If I view the serial monitor output on startup at 74880 Baud I see:
Code: Select all ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8

2nd boot version : 1.6
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

rf cal sector: 249
rf[112] : 00
rf[113] : 00
rf[114] : 01

SDK ver: 2.0.0(5a875ba) compiled @ Aug  9 2016 15:12:27
phy ver: 1055, pp ver: 10.2

"⸮j⸮⸮


I would expect the following settings to work:

QIO flash mode
1M / 64k
ck reset
40MHz flash speed
80MHz cpu speed
115200 upload speed

But they have not and I have tried many combinations and variations. When the module is powered on the blue led flashes ~5-10 times randomly within 5 seconds then stops. When attempting to upload the blue led flashes a few times then stops.

The exact same programming setup works with other ESP01 modules I use so I am confused why it's not working for these new ones. This is the link to the product page:
https://www.ebay.com/itm/ESP-01S-ESP8266-ESP-01-Wireless-Transceiver-Module-Breakout-Breadboard-Adapter/112221319911?ssPageName=STRK%3AMEBIDX%3AIT&var=412532827457&_trksid=p2057872.m2749.l2649

Any ideas?
User avatar
By philbowles
#72390 The ESP-01S has 1MB flash, not 512k like the plain ESP-01, so there are NO settings that will work. You need a new board definition. This is the one I use:

##############################################################
esp01s.name=ESP-01S

esp01s.upload.tool=esptool
esp01s.upload.speed=921600
esp01s.upload.resetmethod=ck
esp01s.upload.maximum_size=958448
esp01s.upload.maximum_data_size=81920
esp01s.upload.wait_for_upload_port=true
esp01s.serial.disableDTR=true
esp01s.serial.disableRTS=true

esp01s.menu.UploadSpeed.115200=115200
esp01s.menu.UploadSpeed.115200.upload.speed=115200
esp01s.menu.UploadSpeed.921600=921600
esp01s.menu.UploadSpeed.921600.upload.speed=921600

esp01s.build.mcu=esp8266
esp01s.build.f_cpu=80000000L
esp01s.build.board=ESP8266_ESP01S
esp01s.build.core=esp8266
esp01s.build.variant=esp01s
esp01s.build.debug_port=
esp01s.build.debug_level=

esp01s.build.flash_size=1M
esp01s.build.flash_ld=eagle.flash.1m64.ld
esp01s.build.flash_freq=40
esp01s.build.flash_mode=qio

esp01s.build.spiffs_start=0xEB000
esp01s.build.spiffs_end=0xFB000
esp01s.build.spiffs_blocksize=4096
esp01s.build.spiffs_pagesize=256

Add that to the boards.txt file in (probably) C:\Users\<your username>\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0
User avatar
By philbowles
#72395
perigalacticon wrote:ok I will do it, but I don't understand why, because there are settings in the Flash Size menu for 512k, 1M, 2M, and 4M; the 1MB setting has 7 SPIFFS size options... ?


Actually I just remembered - that wont work, you need someof my extra files in the "variants" folder: ESP-01S has different pin for builtin LED ....

you will need to change the line: esp01s.build.variant=esp01s to esp01s.build.variant=generic

AND beware of the different pinout!