Uploading using esptool-ck NOT esptool.py


I’ve just trying to switch over to platformio, but I’m having an issue that has me completely stumped. I’m running Windows 10.

I’ve always found that code uploaded to ESP8266 D1 minis with esptool.py fail - it seems to upload, but then it endlessly reboots. This has been an issue on the old Arduino IDE too.

However, I have found that using esptool-ck works fine.

Platformio seems to support both, and I’ve added “platform_packages = tool-esptool@1.413” to my platformio.ini file to attempt to use esptool-ck. However, Platformio seems to keep using esptool.py for the upload despite it downloading the esptool-ck package.

Can anyone help? Also, if anyone has any idea as to why esptool.py doesn’t upload correctly I’d be most grateful.



Looking at the code

Usage of the esptool seems to have been completely switched out in favor of esptoolpy since 2.1.0 without the possiblity to switch back to the legacy tool.

Conversely, if you set

platform = espressif8266 @ 2.0.4

you get the last version which should have been using esptool, although now you’re also automatically using a much older Arduino-core version etc. So that’s not really desirable.

We have observed a large number of such “bootloop” cases where causes of error are pretty much always that a wrong bootloader with respect to the flash size of the module is given, see e.g. this or this or this.

So let’s rather work towards finding out why your ESP boot-loops. Can you:

  • use the esptool.py tool to get information about the chip, e.g.
> python "C:\Users\Maxi\.platformio\packages\tool-esptoolpy\esptool.py" -p COM34 flash_id
esptool.py v2.8
Serial port COM34
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 2c:3a:e8:06:XX:XX
Uploading stub...
Running stub...
Stub running...
Manufacturer: c8
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin...
  • open any serial monitor (e.g. miniterm or hterm) at 74880 baud and post the bootloader messages.

Hi @maxgerhardt,

Thank you very much for your helpful note. Switching to 2.0.4 did indeed solve the problem but as you note this isn’t really a long term fix, so am keen to identify what’s causing it.

As requested (and grateful for your help):

details from esptool:
esptool.py v2.8
Serial port COM4
Detecting chip type… ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 38:2b:78:03:6c:25
Uploading stub…
Running stub…
Stub running…
Manufacturer: 20
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin…

And this is the output from the Serial Monitor that I get:
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
�cl ␃{�o␎$ph
ets Jan 8 2013,rst cause:2, boot mode:(3,6)

Thank you very much for your help.



I think I may have found the offending issue.

I went through my code, and found that one of the libraries that I was calling, a LightwaveRF library that sends radio messages to home automation devices, was causing the boot loops as soon as the set-up command was sent (lw_setup in the setup() routine).

The library I was using is here: GitHub - lawrie/LightwaveRF

I don’t know why this happens only when esptoolpy is used, and not esptool-ck.

The solution may be for me to use a more recent and tested with the ESP8266 → GitHub - roberttidey/LightwaveRF: Arduino Libraries for LightwaveRF 433MHz rx and tx, however if you have any thoughts as to why the upload tools cause the differing behaviour please do let me know!


Does this bootloop appear for a standard blinky sketch and no externally connected hardware as well?

Also it’s pretty bad that the library does an interrupt-processing in this function

Which is not marked as ICACHE_RAM_ATTR. All interrupt-processing code must be in IRAM for the ESP8266. See How to fix "ISR not in IRAM" - #2 by maxgerhardt

The library is 8 years old and was probably written with an Arduino Uno in mind rather than an ESP8266.

Thank you very much for your reply - I think I’ll try and go with a more current library and avoid this issue. In answer to your earlier point, it all works fine - the blinky sketch, and all of my remaining code as long as I don’t use the offending library.