Coder Social home page Coder Social logo

esptool-ck's People

Contributors

deaware avatar edwardbetts avatar grovkillen avatar igrr avatar majenkotech avatar mbeards avatar milan-kupcevic avatar mribble avatar mstovenour avatar nkolban avatar onkelfunny avatar pummelo65 avatar rhaenel avatar tommie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esptool-ck's Issues

ck reset method not working

I have connected my esp07-module as shown here: http://reflowster.com/resources/images/blog/esp8266/usbprogram.png and the ck bootloader reset method isn't working.
Altough with esptool.py it works flawlessly. As i'd like to use the arduino ide for flashing instead of doing it manually it would be cool if this issue could be fixed :)
Here are the differences in the code:

void board_ck_rb()
vs https://github.com/themadinventor/esptool/blob/master/esptool.py#L165
Thanks for your help.

Can't connect to my NodeMCU! Is it dead?

After over 12 hours of trying to make my NodeMCU work, I am being overcome by desperation.
Any idea, or opinion that can help me get this thing talking is welcome.

Windows 7 64-bits
NodeMCU DevKit 0.9

As recommended, I started with installing the CH340 USB Serial driver with the NodeMCU unplugged. I found a 2011 version of the driver, and a 2014 version.

Installing WCH.CN
|__ USB-SERIAL CH340
|__ 11/04/2011, 3.3.2011.11

After the driver installs, Device Manager shows me NO new COM port, which I think is the first bad sign. And I get the message:

"The drive is successfully Pre-installed in advance!" Whatever that means...

Of course, ESP8266Flasher cannot see a new COM port either.

So I went after this as a driver problem. After an Uninstall, the next install (2011, or 2014) said some files were already present. So the uninstalls leave some duty behind...

I then manually cleaned up the registry, any file on disk starting with "CH34", ran malwarebytes to fix inconsistencies and retried. To no avail.

Sooo, at this point, with a driver installed:

-When I connect the NodeMCU to my USB port, I hear the Windows Plug&Play sound, like when we connect a mouse or anything else. And the Device Manager refreshes, so something is happening.

Windows indicates "Installing device driver software..." for a few seconds.
then:
"Device driver software was not successfuly installed"

-When the NodeMCU is connected, the blue LED flashes 4-5 times and a "ESP_A265C8" thing appears on my phone as a WiFi accessible access point. (My phone tells me "54Mbps", 2.4GHz, Connected and Signal Excellent)

Enough seems to be working to drive me bezerk.

The same thing happens on my laptop running XP, and another laptop running Windows 8. Which points to either a driver or a hardware problem. Or a head problem.

But all over the place, I hear stories of seamless installs.

I tried resetting the NodeMCU by shorting the RST pin to ground for a few seconds. Same results.

I have another NodeMCU on order.

Q1: Should I see a new COM port in Device Manager after installing the driver (and before plugging the NodeMCU)?

Q2: Has anyone experienced this and concluded that either the driver was bad, wrongly installed or a bad NodeMCU?

Thank for your help!!!

build on freebsd

any ideas on how to fix this... want to help getting the platformio package to work

root@misc:~/esptool-ck # make clean install
make: "/root/esptool-ck/Makefile" line 5: Missing dependency operator
make: "/root/esptool-ck/Makefile" line 10: Need an operator
make: "/root/esptool-ck/Makefile" line 12: Missing dependency operator
make: "/root/esptool-ck/Makefile" line 15: Unassociated shell command "ifeq ($(UNAME_M),x86_64)"
make: "/root/esptool-ck/Makefile" line 16: Unassociated shell command "DIST_SUFFIX := linux64"
make: "/root/esptool-ck/Makefile" line 17: Unassociated shell command "endif"
make: "/root/esptool-ck/Makefile" line 18: Unassociated shell command "ifeq ($(UNAME_M),i686)"
make: "/root/esptool-ck/Makefile" line 19: Unassociated shell command "DIST_SUFFIX := linux32"
make: "/root/esptool-ck/Makefile" line 20: Unassociated shell command "endif"
make: "/root/esptool-ck/Makefile" line 21: Missing dependency operator
make: "/root/esptool-ck/Makefile" line 23: Need an operator
make: "/root/esptool-ck/Makefile" line 24: Need an operator
make: "/root/esptool-ck/Makefile" line 25: Missing dependency operator
make: "/root/esptool-ck/Makefile" line 28: Need an operator
make: "/root/esptool-ck/Makefile" line 29: Missing dependency operator
make: "/root/esptool-ck/Makefile" line 32: Need an operator
make: "/root/esptool-ck/Makefile" line 35: Need an operator
make: Fatal errors encountered -- cannot continue
make: stopped in /root/esptool-ck

there are freebsd mentions in the makefile so I'm not sure why it is failing...

Mac OS X El Capitan does not work

When I used it previously, it's work fine, but after update on El Capitan have an error:
warning: espcomm_sync failed
error: espcomm_open failed

P.S. On virtual machine with Windows 7 work fine.

BLOCKSIZE_FLASH

what do you think about higher BLOCKSIZE_FLASH?
I my test i get this Upload times:
BLOCKSIZE_FLASH = 0x0400 => Upload-Time: 27 Seconds
BLOCKSIZE_FLASH = 0x0800 => Upload-Time: 25 Seconds
BLOCKSIZE_FLASH = 0x1800 => Upload-Time: 22 Seconds

espcomm_sync failed and espcomm_send_command(FLASH_DOWNLOAD_DATA) failed

esptool-ck works fine for the x64 and x86 machine. Since I am using R-Pi for binary loading, It's ARM version doesn't seem to work reliably. This version shows unpredictable behaviour and termination of binary loading in the middle of the loading process. I tried with another tool esptool.py and it showed the same behaviour
Also sometimes ESP doesn't run after programming. Although the program gets loaded properly with 100 percent. Reprogramming again with toggling the baud rate resolves the issue sometimes.

I am programming many of them and this process needs to be fast. My power supply is sufficient to provide enough power. Please guide me if I am missing something or doing wrong.

Esptool 4.6 not reliable on my flash setup.

I try differend baudrate but not seem rs232 related

/home/user/.arduino15/packages/esp8266/hardware/esp8266/2.0.0/../../../tools/esptool/0.4.6/esptool -vv -cd none -cb 460800 -cp /dev/ttyUSB0 -ca 0x100000 -cf /tmp/build8924734518208192267.tmp/esp8266-WebServices.spiffs.bin
esptool v0.4.6 - (c) 2014 Ch. Klippel [email protected]
setting board to none
setting baudrate from 115200 to 460800
setting port from /dev/ttyUSB0 to /dev/ttyUSB0
setting address from 0x00000000 to 0x00100000
espcomm_upload_file
stat /tmp/build8924734518208192267.tmp/esp8266-WebServices.spiffs.bin success
opening port /dev/ttyUSB0 at 460800
tcgetattr
tcsetattr
serial open
opening bootloader
resetting board
trying to connect
setting character timeout 0
done
setting character timeout 1
done
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_open
Uploading 3125248 bytes from /tmp/build8924734518208192267.tmp/esp8266-WebServices.spiffs.bin to flash at 0x00100000
erasing flash
size: 2fb000 address: 100000
first_sector_index: 256
total_sector_count: 763
head_sector_count: 16
adjusted_sector_count: 747
adjusted_size: 2eb000
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
setting timeout 10000
setting character timeout 100
done
setting timeout 1
setting character timeout 1
done
espcomm_send_command: receiving 2 bytes of data
writing flash
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................warning: espcomm_send_command: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed
warning: espcomm_send_command: didn't receive command response
closing bootloader

but sometimes it stops immediately with FLASH_DOWNLOAD_BEGIN

I suppose that my flash is slow and some timeout occur during writing data or starting writing,
sketck and flash work well , only spiffs 3M stop randomly upload.

Difference between esptool-ck and esptool.py?

This is really a question instead of an issue. I am curious how esptool-ck is different from esptool.py (other than the obvious differences in the command line parameter names)? The reason I am asking is that when I flashed a firmware (compiled in Arduino) that uses SPIFFS, with esptool.py the device always fails to mount SPIFFS, while with esptool-ck it works fine. I am curious to find out why. Thanks.

Espcomm_sync failure Wemos D1R2

From @johnwa27 on May 10, 2017 2:51

I'm getting this well known failure. All the responses seem to place blame on the users code or wiring. But it's happening to me on a Wemos board with nothing connected to it. It happens randomly, sometimes my code uploads, other times it will take 3 or 4 tries. Closing the serial monitor seems to help a bit.

This is not an issue with my code, my code works when it uploads and it happens with several different working programs.
It's a hardware/ide issue. It's made even worse since it has to recompile every upload attempt.

When is someone going to take this issue seriously?

Copied from original issue: esp8266/Arduino#3224

Make fails on windows 10

So I've tried with both nmake from vs studio express 2015 and WinGNU make, and neither works. Any pointers on how to build this project?

WinGNU make

make
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
cc -std=gnu99 -Os -Wall -Iinfohelper -Ielf -Ibinimage -Iargparse -Iserialport -Iespcomm -DWINDOWS -DVERSION="" -c -o argparse/argparse.o argparse/argparse.c
process_begin: CreateProcess(NULL, cc -std=gnu99 -Os -Wall -Iinfohelper -Ielf -Ibinimage -Iargparse -Iserialport -Iespcomm -DWINDOWS -DVERSION="" -c -o argparse/argparse.o argparse/argparse.c, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [argparse/argparse.o] Error 2

nmake

Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
Copyright (C) Microsoft Corporation. All rights reserved.

makefile(1) : fatal error U1036: syntax error : too many names to left of '='
Stop.

espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed

After the last commit (d7dcbf0) utility esptool.exe constantly produces an error:

C:\Espressif> esptool.exe -cp COM2 -cd ck -ca 0x00000 -cf eagle.flash.bin -vvv

esptool v0.0.3a - (c) 2014 Ch. Klippel [email protected]
setting port from COM1 to COM2
setting board to ck
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
stat eagle.flash.bin success
setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
read 0, requested 1
espcomm cmd: didn't receive command response
trying to connect
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
espcomm cmd: receiving 2 bytes of data
espcomm_cmd: received 2 bytes:
0x00
0x00
espcomm cmd: response 0x20120707
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_open
Uploading 28960 bytes from eagle.flash.bin to flash at 0x00000000
erasing flash
calculated erase delay: 300ms
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
setting serial port timeouts to 300 ms
read 0, requested 1
setting serial port timeouts to 1000 ms
warning: espcomm cmd: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
closing bootloader
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete

Fix flash_params in images during download?

First, thank you for this tool! I ported the download piece to a bare metal MCU and could update production hardware in the field. But that quit working when I got modules with flash larger than 4 mbit (the default). That's because the flash params are not set in the boot image.

I'll share the result of a hard-coded fix to get feedback.

The boot files need the flash parameters in their headers to be set before downloading. Is the strategy of esptool-ck for user to convert those binaries into other binary with parameters set and then download using the latter? If so, how do you do that conversion?

I can install the 1.5.3 SDK binaries on a 16 mbit (2 MB) flash with esptool.py like so:

esptool.py -p /dev/tty.usbserial-FTHC2V0I write_flash -fs 16m-c1 0x0 boot_v1.5.bin 0x1000 user1.2048.new.5.bin 0x1fc000 esp_init_data_default.bin 0xfe000 blank.bin 0x1fe000 blank.bin

Here is the parallel using esptool-ck:

esptool -bz 16M -cp /dev/tty.usbserial-FTHC2V0I -ca 0x0 -cf boot_v1.5.bin -ca 0x1000 -cf user1.2048.new.5.bin -ca 0x1fc000 -cf esp_init_data_default.bin -ca 0xfe000 -cf blank.bin -ca 0x1fe000 -cf blank.bin

I got it to work with esptool-ck by making this change:

diff --git a/espcomm/espcomm.c b/espcomm/espcomm.c
index 52e0474..f84565a 100644
--- a/espcomm/espcomm.c
+++ b/espcomm/espcomm.c
@@ -415,6 +415,25 @@ bool espcomm_upload_mem(uint8_t* src, size_t size, const char* source_name)
         size -= write_size;
         src += write_size;

+        /*
+         * From esptool.py
+         * # Fix sflash config data.
+         * if address == 0 and image[0] == '\xe9':
+         *   print 'Flash params set to 0x%02x%02x' % (flash_mode, flash_size_freq)
+         *   image = image[0:2] + flash_params + image[4:]
+         */
+        if (espcomm_address == 0 && count == 0 && (flash_packet[4] & 0xff) == 0xe9)
+        {
+            /* replace flash_params in header of image
+             * from esptool.py...
+             * flash_mode = {'qio':0, 'qout':1, 'dio':2, 'dout': 3}[args.flash_mode]
+             * flash_size_freq = {'4m':0x00, '2m':0x10, '8m':0x20, '16m':0x30, '32m':0x40, '16m-c1': 0x50, '32m-c1':0x60, '32m-c2':0x70}[args.flash_size]
+             * flash_params = struct.pack('BB', flash_mode, flash_size_freq)
+             */
+            LOGINFO("setting flash_parms in boot to qio, 16m-c1");
+            flash_packet[4] = (flash_packet[4] & 0x0000ffff) | 0x50000000;
+        }
+
         send_packet.checksum = espcomm_calc_checksum((unsigned char *) (flash_packet + 4), BLOCKSIZE_FLASH);
         res = espcomm_send_command(FLASH_DOWNLOAD_DATA, (unsigned char*) flash_packet, BLOCKSIZE_FLASH + 16, 0);

What do you think? Does this tool need a generic way of doing the above?

Compilation fails with โ€˜CRTSCTSโ€™ undeclared

On Ubuntu 14.04.1 LTS compilation fails:

me@host:~/esptool-ck$ make
gcc -Iinfohelper -Ielf -Ibinimage -Iargparse -Iserialport -Iespcomm  -std=c99 -Os -Wall  -DLINUX -c serialport/serialport.c -o build/serialport/serialport.o
serialport/serialport.c: In function โ€˜serialport_openโ€™:
serialport/serialport.c:374:22: error: โ€˜CRTSCTSโ€™ undeclared (first use in this function)
     term.c_cflag &= ~CRTSCTS;
                      ^
serialport/serialport.c:374:22: note: each undeclared identifier is reported only once for each function it appears in
make: *** [build/serialport/serialport.o] Error 1

esptool.py install

When I installed esptool.py it was installed on a path that began at the root level on my mac OS10.11. Is there a way to control the installation so that the path begins at the User level?

add auto-reset feature

I've added support for auto-reset using an RC filter between Rx and RST, similar to what I did for the Arduino.
http://nerdralph.blogspot.ca/2014/02/zero-wire-serial-auto-reset-for-arduino.html
I tested it with a 7.5k resistor between Rx and RST, a 4.7uF cap between RST and VCC (no diode required). It's a bit oversized; anything with a RC constant of 10ms or more should be fine. To be sure a long series of zero bytes won't trigger it, a diode in series with the resistor can be added.

Built with gcc 4.8.1/MingW and tested under Win7E/64, and it works great. It has the added bonus of improving stability - I don't get espcomm_sync failed any more. This is likely because the cap on the reset line filters noise that can cause spurious resets.

commit e2a0321446d301cdf4afb1c91327211e25afa1d8
Author: unknown [email protected]
Date: Sun Apr 5 22:51:30 2015 -0300

add auto-reset using RC circuit attached to break

diff --git a/espcomm/espcomm_boards.c b/espcomm/espcomm_boards.c
index bb5cc26..c1da780 100644
--- a/espcomm/espcomm_boards.c
+++ b/espcomm/espcomm_boards.c
@@ -63,14 +63,16 @@ void espcomm_board_reset_into_app(espcomm_board_t* board)
//

// "ck" board: dtr pulls down gpio0, rts pulls down reset
+// also supports reset with RC circuit triggered by break signal

void board_ck_rb()
{
serialport_set_rts(1);
serialport_set_dtr(1);

  • serialport_send_break();
    espcomm_delay_ms(5);
    serialport_set_rts(0);
  • espcomm_delay_ms(50);
  • espcomm_delay_ms(250); // wait for break to finish
    serialport_set_dtr(0);
    }

Erase?

Using latest bin: esptool-0.4.11-win32.zip

But how I see, I can't erase my WeMos D1 mini

esptool.exe -cp COM7 -cb 115200 -cd nodemcu -ce
warning: espcomm_send_command: didn't receive command response
error: espcomm_erase_flash: FLASH_DOWNLOAD_BEGIN failed
error: Invalid argument or value after -ce (argument #8)

btw...but I can flash it without any issue.

upload problem encountered in Arduino IDE

Here's the end of trying to build WiFiScan example using the 1.6.4-673-g8cd3697 board definition:

/Users/boneskull/Library/Arduino15/packages/esp8266/tools/esptool/0.4.4/esptool -eo 
/var/folders/d4/vrj66_rs375gh9_33xr9bnv80000gs/T/build7455700842258194699.tmp/WiFiScan.cpp.elf 
-bo /var/folders/d4/vrj66_rs375gh9_33xr9bnv80000gs/T/build7455700842258194699.tmp/WiFiScan.cpp_00000.bin 
-bm qio -bf 40 -bz 512K -bs .text -bs .data -bs .rodata -bc -ec -eo 
/var/folders/d4/vrj66_rs375gh9_33xr9bnv80000gs/T/build7455700842258194699.tmp/WiFiScan.cpp.elf 
-es .irom0.text 
/var/folders/d4/vrj66_rs375gh9_33xr9bnv80000gs/T/build7455700842258194699.tmp/WiFiScan.cpp_10000.bin 
-ec 

Sketch uses 231,360 bytes (44%) of program storage space. Maximum is 524,288 bytes.
Uploading 32848 bytes from /var/folders/d4/vrj66_rs375gh9_33xr9bnv80000gs/T/build7455700842258194699.tmp/WiFiScan.cpp_00000.bin to flash at 0x00000000
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed

Trying the upload manually, with a somewhat different command, also fails:

$ esptool -cp /dev/cu.usbserial -cf WiFiScan.cpp_00000.bin -ca 0x10000 -cf WiFiScan.cpp_10000.bin -vvvv
esptool v0.4.4 - (c) 2014 Ch. Klippel <[email protected]>
    setting port from /dev/tty.usbserial to /dev/cu.usbserial
    espcomm_upload_file
    stat WiFiScan.cpp_00000.bin success
opening port /dev/cu.usbserial at 115200
    tcgetattr
    tcsetattr
    serial open
opening bootloader
resetting board
trying to connect
    setting character timeout 0
    done
    setting character timeout 1
    done
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
        espcomm_send_command: didn't receive command response
trying to connect
    setting character timeout 0
    done
    setting character timeout 1
    done
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: received 2 bytes:
        0x00
        0x00
        espcomm_send_command: response 0x20120707
    espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: received 2 bytes:
        0x00
        0x00
        espcomm_send_command: response 0x20120707
    espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: received 2 bytes:
        0x00
        0x00
        espcomm_send_command: response 0x20120707
    espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: received 2 bytes:
        0x00
        0x00
        espcomm_send_command: response 0x20120707
    espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: received 2 bytes:
        0x00
        0x00
        espcomm_send_command: response 0x20120707
    espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: received 2 bytes:
        0x00
        0x00
        espcomm_send_command: response 0x20120707
    espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: received 2 bytes:
        0x00
        0x00
        espcomm_send_command: response 0x20120707
    espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: received 2 bytes:
        0x00
        0x00
        espcomm_send_command: response 0x20120707
    espcomm_open
Uploading 32848 bytes from WiFiScan.cpp_00000.bin to flash at 0x00000000
    erasing flash
    size: 008050 address: 000000
    first_sector_index: 0
    total_sector_count: 9
    head_sector_count: 9
    adjusted_sector_count: 5
    adjusted_size: 005000
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    setting timeout 10000
    setting character timeout 100
    done
    setting timeout 1
    setting character timeout 1
    done
    espcomm_send_command: receiving 1796 bytes of data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
closing bootloader

I tried various combinations of flags -bf, -bm and -cb to no avail.

But esptool.py uploads fine:

$ esptool.py --port /dev/cu.usbserial write_flash 0x00000 WiFiScan.cpp_00000.bin 0x10000 WiFiScan.cpp_10000.bin
Connecting...
Erasing flash...
Writing at 0x00008000... (100 %)
Erasing flash...
Writing at 0x00040400... (100 %)

Leaving...

Setup:

  • esptool v0.4.4
  • ESP-01
  • PL-2303HX USB-to-serial adapter like this
  • Mac OS 10.10.3
  • pretty sure I'm using the FTDI v2.3 driver as found here but I don't know how to determine that.

Problem getting this to run in macOS High Sierra

Im here because I have been lead to believe trying "the latest esptool-ck release" will help me be able to load sketches on the SparkFun ESP8266 thing dev again. Ive only been experiencing this problem since updating to macOS High Sierra.

I downloaded the esptool-ck zip from this repository, unzipped the folder and ran TODO unix executable because it seemed like a good idea at the time, but when I run esptool -v it returns "command not found". As expected I still cant upload sketches to the esp8266 thing dev from the Arduino IDE.

The errors I see when trying to upload the Blinky example sketch (nothing plugged in):
warning: espcomm_send_command: didn't receive command response warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed warning: espcomm_send_command: wrong direction/command: 0x01 0x03, expected 0x01 0x04 error: espcomm_upload_mem failed error: espcomm_upload_mem failed

Have I been lead to the right place? If so, how can I get this working on my machine?

Flashing binary not same result as with esptool.py

Cant flash micropython with esptool-ck, only works with esptool.py

Download micropython binary, any version.
erase flash, then flash with
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266.bin
the micropython will display a terminal prompt on the serial port and there will be a new wifi AP.

now erase flash and flash again, but with esptool-ck
esptool -cb 460800 -bz 32M -cd nodemcu -cf esp8266.bin
issue is, there's no functionality. no terminal prompt and no AP. the UART led blinks blue repeatedly.

I have tried on nodemcu board and on a personal circuit.
I have tried all four -bm options
I have tried 40 and 80 mhz flash speed.
out of ideas.. saw someone else had similar issue further down on issue page.

Add an erase flash option

This tool is my esp flasher of choice. However I found that I needed to erase all my flash memory in the same fashion that esptool.py erase_flash does and I was unable to find a corresponding option in this tool. This issue asks for an examination of what would be needed to be added in order to erase the flash of an ESP8266 using this command.

cannot flash wemos d1 mini in Arduino IDE

I'm using Windows 10 64bit Pro with Arduino IDE 1.8.3, and Python 2.7.13. The error I get when uploading is "error: espcomm_upload_mem failed". I have previously uploaded to a Huzzah breakout with no problem. Can this be fixed? The output I have when uploading is:

Sketch uses 222221 bytes (21%) of program storage space. Maximum is 1044464 bytes.
Global variables use 31588 bytes (38%) of dynamic memory, leaving 50332 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 nodemcu -cb 921600 -cp COM5 -ca 0x00000 -cf C:\Users\PERIGA~1\AppData\Local\Temp\arduino_build_434248/Blink.ino.bin 
esptool v0.4.9 - (c) 2014 Ch. Klippel <[email protected]>
	setting board to nodemcu
	setting baudrate from 115200 to 921600
	setting port from COM1 to COM5
	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
	serialport_receive_C0: 80 instead of C0
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
	serialport_receive_C0: 80 instead of C0
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
	serialport_receive_C0: 80 instead of C0
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
	serialport_receive_C0: 80 instead of C0
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
	serialport_receive_C0: 80 instead of C0
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
	serialport_receive_C0: 80 instead of C0
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
	serialport_receive_C0: 80 instead of C0
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
	serialport_receive_C0: 80 instead of C0
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
	serialport_receive_C0: 80 instead of C0
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

fatal: not a valid object name HEAD

Hello
I have just download esptool-ck and using from windows
What step I need to do when I build source esptool-ck?
I have installed git and set: "git init"
then cd to folder of source esptool-ck and make
But have error: Fatal: Not a valid object name HEAD

Please help me!
Thanks

RTS question

have you tested a standard USB CDC device except cp2102 and ch340?
I expect to receive an RTS packet(21 22 02 00 00 00 00 00) to reset esp8266.
but I can not receive it.
I add the source code

serialport_set_rts(1);
serialport_set_dtr(0);

in function serialport_close()
.
packet(21 22 02 00 00 00 00 00) will be sended.

Can't erase or reflash: FLASH_DOWNLOAD_BEGIN failed

I've been having lots of issues trying to reflash a Wemos D1 mini (ESP-12F, CH340G USB<->Serial, 4M bytes flash). I was previously able to flash it with the Arduino IDE, but after trying to reflash it with the micropython distribution, it seems as though I've soft-bricked it.

I get the following error with esptool when trying to erase the flash:

$ ./esptool -vv -cp /dev/tty.wchusbserial1410 -cd nodemcu -ce
esptool v0.4.11 - (c) 2014 Ch. Klippel <[email protected]>
    setting port from /dev/tty.usbserial to /dev/tty.wchusbserial1410
    setting board to nodemcu
    espcomm_erase_flash
opening port /dev/tty.wchusbserial1410 at 115200
    tcgetattr
    tcsetattr
    serial open
opening bootloader
resetting board
trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    setting timeout 1000
    setting timeout 100
warning: espcomm_send_command: didn't receive command response
error: espcomm_erase_flash: FLASH_DOWNLOAD_BEGIN failed
error: Invalid argument or value after -ce (argument #7)

If I try to write the flash, I get the same error:

$ ./esptool -vv -cp /dev/tty.wchusbserial1410 -bz 32M -cd nodemcu -cb 115200 -cf esp8266-20160823-v1.8.3-41-g253e1a6.bin
esptool v0.4.11 - (c) 2014 Ch. Klippel <[email protected]>
    setting port from /dev/tty.usbserial to /dev/tty.wchusbserial1410
setting flash size from 512K to 32M
    setting board to nodemcu
    setting baudrate from 115200 to 115200
    espcomm_upload_file
    espcomm_upload_mem
opening port /dev/tty.wchusbserial1410 at 115200
    tcgetattr
    tcsetattr
    serial open
opening bootloader
resetting board
trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
    espcomm_send_command: receiving 2 bytes of data
Uploading 530708 bytes from esp8266-20160823-v1.8.3-41-g253e1a6.bin to flash at 0x00000000
    erasing flash
    size: 081914 address: 000000
    first_sector_index: 0
    total_sector_count: 130
    head_sector_count: 16
    adjusted_sector_count: 114
    erase_size: 072000
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    setting timeout 15000
    setting timeout 100
warning: espcomm_send_command: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
closing bootloader
error: espcomm_upload_mem failed
error: Invalid argument or value after -cf (argument #11)

I'm able to read the chip_id and MAC with esptool.py:

$ esptool.py --port /dev/tty.wchusbserial1410 chip_id
esptool.py v1.1
Connecting...
Chip ID: 0x00------
$ esptool.py --port /dev/tty.wchusbserial1410 read_mac
esptool.py v1.1
Connecting...
MAC: 5c:cf:7f:--:--:--

If I connect with a serial terminal at 74880 baud I can see the module communicates from the bootloader when I press the restart button:

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

I've tried on Mac OS X 10.11.6 (with the signed driver) and on a Windows 10 machine (with automatically installed driver), both with the same results. I've also tried with virtual machines and a multitude of cables. Nothing seems to reflash it (I've tried esptool.py, esptool-ck, NodeMCU Flasher, and the espressif flash tool).

Any suggestions??

Flash erase timeout for 3M SPIFFS image

I think it is time to revisit that pesky timeout setting again :) I have an Adafruit HUZZAH with 4M flash. When flashing the SPIFFS at 3M esptool gives up waiting on the flash erase. I can select the 1M SPIFFS configuration in the Arduino IDE and it will work fine. I did a few experiments manually creating SPIFFS binaries then flashing them and found the following:
1M SPIFFS image --> 9 seconds to complete the flash erase
2M SPIFFS image --> 13 seconds to complete the flash erase
3M SPIFFS image --> 18 seconds to complete the flash erase
I was able to measure that last one after I cloned master and changed the timeout in the code.

Symptom:

C:\Programs\Eclipse_Neon_2\arduinoPlugin\tools\esp8266\mkspiffs\0.1.2\mkspiffs.exe -c C:\Files\ESP8266\FSBrowser\data -p 256 -b 8192 -s 3125248 C:\Files\ESP8266\FSBrowser\Release\FSBrowser.spiffs-3M.bin
C:\Programs\Eclipse_Neon_2\arduinoPlugin\tools\esp8266\esptool\0.4.9\esptool.exe -vv -cd nodemcu -cb 256000 -cp COM6 -ca 0x100000 -cf C:\Files\ESP8266\FSBrowser\Release\FSBrowser.spiffs-3M.bin
esptool v0.4.9 - (c) 2014 Ch. Klippel <[email protected]>
        setting board to nodemcu
        setting baudrate from 115200 to 256000
        setting port from COM1 to COM6
        setting address from 0x00000000 to 0x00100000
        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
        read 0, requested 1
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 2 bytes of data
        espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: receiving 2 bytes of data
        espcomm_send_command: receiving 2 bytes of data
Uploading 3125248 bytes from C:\Files\ESP8266\FSBrowser\Release\FSBrowser.spiffs-3M.bin to flash at 0x00100000
        erasing flash
        size: 2fb000 address: 100000
        first_sector_index: 256
        total_sector_count: 763
        head_sector_count: 16
        adjusted_sector_count: 747
        erase_size: 2eb000
        espcomm_send_command: sending command header
        espcomm_send_command: sending command payload
        setting serial port timeouts to 15000 ms
        read 0, requested 1
        setting serial port timeouts to 1000 ms
warning: espcomm_send_command: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
closing bootloader
        flush start
        setting serial port timeouts to 1 ms
        setting serial port timeouts to 1000 ms
        flush complete
error: espcomm_upload_mem failed

Pull request is on it's way.

CH341A stuck on opening ttyUSB0

this chip works fine in screen and esptool.py but esptool-ck locks up on opening port. no additional info with -vvv

putting chip in loopback gives incorrect data received.

Unable to pull GPIO0 down

I am not sure what causing this issue. But, flashing with native SDK firmware works well. First time I used arduino compiled binary (using esptool-ck to flash via raspberrypi) causes this issue:

esptool-ck/esptool -vv -cd none -cb 115200 -cp /dev/ttyAMA0 -ca 0x00000 -cf main.ino.generic.bin

I am using board none - not sure if it has anything to do with that. More info about this problem: esp8266/Arduino#1474

@igrr any idea?

problem programming ESP12F with -bm dio option

I have been using esptool (v0.4.9) to program ESP12F modules for some months now without any problems. I am running the tool on Win 10.
A typical command line is:
esptool.exe -vv -cd nodemcu -cb 230400 -cp COM8 -ca 0x00000 -cf WiFi_A1k.ino.bin

Recently I got some new ESP12F modules and discovered that they would program but would not then reboot correctly. Further investigation showed that the new modules have flash memory from a different vendor (GigaDevice instead of WinBond).

I downloaded the Expressif flash download tool and discovered that the modules worked fine when programed in SPI DIO mode but not when programmed in QIO mode ( the default mode in esptool).

I then tried using esptool with the -bm switch to define DIO mode:
esptool.exe -vv -cd nodemcu -cb 230400 -cp COM8 -bm dio -ca 0x00000 -cf WiFi_A1k.ino.bin
but although the output from esptool showed that dio mode had been selected, the end result was the same as before, module programmed but not booting.
I also tried:
esptool.exe -bm dio -vv -cp COM8 -cd nodemcu -cb 230400 -ca 0x00000 -cf WiFi_A10k.ino.bin in case the order of switches had an effect, but it made no difference.

I then tried using the python version of esptool (esptool.py) with DIO mode set and that worked fine.

Is there a bug with the -bm switch in esptool.exe or have I simply misunderstood how to use it?

builds for OSX for version 10.10

hi.

i just ran into the esptool returned 139-error on a 10.7.5 machine.

the release-builds for OSX are for system version min. 10.10.

...
  version 10.10
      sdk 10.10

that creates problems on older systems.

Nodemcu board

I have tried to use the Arduino IDE for ESP8266 but fails to upload the sketch after compile! I also tried to upgrade the esptool.exe to later version! I am running on Windows 8.1 (Version 6.3.9600) and my board is a Nodemcu board and it identifies as "USB-SERIAL CH340 (COM13)"

esptool.exe -vvvv -cd none -cb 115200 -cp COM13 -ca 0x00000 -cf sketch_apr08a.cpp_00000.bin -ca 0x40000 -cf sketch_apr08a.cpp_40000.bin

esptool v0.4.2-4-ga0dd57d - (c) 2014 Ch. Klippel [email protected]
setting board to none
setting baudrate from 115200 to 115200
setting port from COM1 to COM13
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
stat C:\Users\Mattias\AppData\Local\Temp\build7182115499530350427.tmp/sketch_apr08a.cpp_00000.bin success
setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
read 0, requested 1
espcomm cmd: didn't receive command response
trying to connect
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
read 0, requested 1
espcomm cmd: didn't receive command response
trying to connect
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
serialport_receive_C0: 73 instead of C0
espcomm cmd: didn't receive command response
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
read 0, requested 1
espcomm cmd: didn't receive command response
trying to connect
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
serialport_receive_C0: 73 instead of C0
espcomm cmd: didn't receive command response
trying to connect
flush start
setting serial port timeouts to 1 ms
flushed 2 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
read 0, requested 1
espcomm cmd: didn't receive command response
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
read 0, requested 1
espcomm cmd: didn't receive command response
trying to connect
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
read 0, requested 1
espcomm cmd: didn't receive command response
trying to connect
flush start
setting serial port timeouts to 1 ms
flushed 0 bytes
setting serial port timeouts to 1000 ms
flush complete
espcomm_cmd: sending command header
espcomm_cmd: sending command payload
read 0, requested 1
espcomm cmd: didn't receive command response
warning: espcomm_sync failed
error: espcomm_open failed

Failed to flash new ESP-12S Module, works after entering boot mode manually

I purchased a handful of ESP-12S modules directly from AI-Thinker (the manufacturing). When I first connect the module, this is the default output I get on the console as expected (hitting Enter gives me the ERROR).

Ai-Thinker Technology Co. Ltd.

ready

ERROR

ERROR

I try to flash it using the console commands:

esptool -cp COM3 -cd nodemcu -cb 115200 -cf firmware.bin -vvv

And this is the output:

esptool v0.4.11 - (c) 2014 Ch. Klippel <[email protected]>
        setting port from COM1 to COM3
        setting board to nodemcu
        setting baudrate from 115200 to 115200
        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
                flushed 0 bytes
        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

This repeats until it fails. Then, I hold GPIO0 low and reset the chip. I run the above again and it successfully programs. At this point, I can program it over and over without having to manually enter bootloading. Not sure what's going on here. Any thoughts on this?

flash size is not working

I tried flashing Espruino using this tool but the flash size doesn't seem to have any effect on my ESP-07 and NODEMCU modules. If I use -v, it says "setting flash size from 512K to 1M" or "setting flash size from 512K to 4M" but according to Espruino, the memory map is just 512K.

If I use the official ESP Flash Download Tool, it sets the flash size properly and Espruino reports the correct memory map. But this tool is a pain because it doesn't use DTR/RTS and cannot be invoked via command line.

esptool 0.4.6 updloads something weird, but esptool.py does it fine

Hi,
I'm facing an strange problem on OSX 10.11. When I upload the firmware to my esp8266 E-12 with esptool 0.4.6, the chip doesn't work fine.

The problem is that I don't know what happens when I upload with esptool. I mean, my device has a multi color led that shows a different color depending on its state. Also prints some traces to the serial port. Well, when I upload with esptool, it doesn't print anything, and the led behaviour is crazy. But I actually don't know what's happening inside the chip.

esptool -vv -cd ck -cb 115200 -cp /dev/cu.usbserial-AL01BY0E -cf firmware.bin

If I upload the same firmware by esptool.py, everything works fine. The command I execute is:

esptool.py --port /dev/cu.usbserial-AL01BY0E write_flash 0x00000 firmware.bin

Work around sync issue when long 0xff sequence is transmitted

From @anisimovsergey on March 23, 2016 22:55

Basic Infos

Hardware

Hardware: olimex mod-wifi-esp8266
Core Version: 2.1.0

Description

I can successfully upload compiled code using Sketch->Upload (Ctrl+U) but whenever I try to upload a bin file for SPIFFS, the esptool.exe (0.4.8) flashing process stops at random moments (but always on flashing the actual data) with the error saying "read 0, requested 1
warning: espcomm_send_command: didn't receive command response"

I investigated the issue a bit and found out that I can actually upload compiled program (not a SPIFFS image) in the same memory area 0x00100000 without a problem (!) and it made me thinking that there must be some difference in the files content.

I checked the files and found out that the file produced by mkspiffs.exe (0.1.2) contains a lot of sequential 0xFFs (11111111). I forcefully replaced them by 0xAAs (10101010) just for sake of experiment and tried to upload the file. It worked! So I'm assuming that the there is a RS232 timer synchronization problem here. I searched on the Web and it seems like I'm not alone having this problem, so is it possible to solve it somehow? Sorry for my naive question, but does SPIFFS format requires 0xFFs or they can be replaced with 0xAA? Is it possible to make an optional parameter for mkspiffs?

Settings in IDE

Module: olimex mod-wifi-esp8266
Flash Size: 2M
CPU Frequency: 80Mhz
Flash Mode: qio
Flash Frequency: 40Mhz
Upload Using: SERIAL
Reset Method: none

Sketch

\libraries\ESP8266WebServer\examples\FSBrowser\

Debug Messages

espcomm_send_command: sending command payload
setting serial port timeouts to 15000 ms
setting serial port timeouts to 1000 ms
espcomm_send_command: receiving 2 bytes of data
writing flash

.......................... read 0, requested 1
warning: espcomm_send_command: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed
warning: espcomm_send_command: wrong direction/command: 0x01 0x03, expected 0x01 0x04
closing bootloader

Copied from original issue: esp8266/Arduino#1813

DTR/RTS seem to get manipulated even if reset method is set to none

Hello, I'm having a problem trying to upload a sketch onto ESP8266 using an Arduino MEGA as a usb serial adapter.
Please note that the MEGA is not merely used as a serial adapter, but it goes into that mode by issuing a specific command from the terminal. Then it goes to serial mirroring mode, and triggers the ESP8266 to go into bootloader mode. It should be ready to flash the ESP8266.
The problem is that when I start flashing from Arduino IDE (setting the resetmethod to none) the Arduino board gets resetted so I lose the serial mirroring connection, and the esptool rightly outputs espcomm_sync_failed, espcomm_open_failed stuff.
What am I missing? It should be fairly trivial to upload a sketch when the serial mirroring is activated and NO DTR/RTS intervention is set.
Thank you very much!
Emiliano

Problem with writing files that are not a multiple of the flash block size?

I've been trying to use esptool-ck instead of the Python version of esptool for loading files generated by the esp-link project. At first, the loaded code wouldn't work correctly. Then I noticed that the Python code was always loading a multiple of the flash block size (1024). I wrote a trivial program to pad all of the files I was trying to load to a multiple of 1024 bytes and now the code loaded by esptool-ck seems to work fine. Is there a bug in esptool-ck when trying to load files that are not a multiple of the flash block size?

Add delay after reset option

I need a new 'feature' (I think it doesn't already exist) to support a board I'm working on. It's quite simple. After doing the RTS and DTR control logic, I might need to inject a fixed delay before engaging in Serial download. The reason is because in my design USB serial traffic can only reach the ESP8266 by being repeated through another microcontroller. That microcontroller itself has a bootloader, and it is also reset using the DTR line. So I need to clear the timeout for the upstream microcontroller bootloader before sending serial data destined for the ESP8266 (through it). Does that makes sense?

Reading through the code, I think the delay would probably need to be inserted right before here / after here.

I can think of two ways to integrate the feature. The first would be to expose a new field (e.g. post_reset_delay) in the espcomm_board_ structure, with all the existing board definitions set to 0 or something. The second way would be to expose it as a new arg_parse handler, probably a new case here (e.g. -cr). I don't know that one of these is better than the other philosophically.

@igrr What do you think? If it's acceptable and of general interest, and you can provide guidance for which way to go about implementation, I would be happy to implement it and submit a pull request. FWIW, I'm planning to implement a very similar reset circuit to the nodemcu one.

ESP32 flashing issue

Hi ,
I am facing issue when used on ESP32 on both master and checkin where ESP32 was "just" supported.

Commit Used:

Commits on Jan 25, 2016
Update readme to mention ESP32
edb9136

Setup:
Trying as if using esptool.py , connect Wroom-23 to Linux VM , connection seems to be fine with no issue.

Command:
sudo ./esptool -cp /dev/ttyUSB0 -cd ck -cc esp32 -ca 0x10000 -cf esp-at.bin -v 4

Output:
Seems some issue during (FLASH_DOWNLOAD_BEGIN) , no response seen from module and exiting.
Let me know if customization required or if it is known issue (could not find in issue section).
I assume this is C port of esptool.py and has equivalent features of same.

More info & logs:

https://www.esp32.com/viewtopic.php?f=13&t=2165&p=10449#p10449

DTR Line

This is related to this issue, but now that I've tracked down part of that issue to esptool-ck I'm filing a bug here.

I'm programming the esp8266 through a sam3x over native USB using the USB CDC serial driver developed for Arduino Due. I used the 0.4.12 prebuilt windows exe and it fails. If I build my own exe using cygwin it succeeds.

The issue is that the USB CDC driver expects DTR to be active. However this project isn't setting DTR active (DTR is active low so I'm expecting DTR to be a low voltage while transmitting, but it is high with your pre-built exe). You can see some waveforms showing the difference in dtr voltage between the cygwin build and the pre-built exe here: http://glacialwanderer.com/files/2017/dtr_waveform.png

I suspect the issue is in serialport.c. Changing "sDCB.fDtrControl = DTR_CONTROL_DISABLE;" to enable might fix this problem in call cases (my guess is disabled might be handled differently using the cygwin build environment than yours).

However, since I can't reproduce the failure I can't verify it. Can you tell me what build environment you are using to make the prebuilt exes? Once I know that then I should be able to reproduce the issue I'm seeing in the prebuilt exe and verify a fix for it.

Here are some things I don't understand:

  1. Why cygwin is showing different behavior than whatever build enviroment you are using to make the exe.
  2. Why on the wave for you are that active pulse (remember dtr is active low) with the prebuilt exe. However, that brief pulse won't work for Arduino's cdc usb serial driver since it checks for the active dtr state on every usb write.

Here are the command line parameters I'm using with the prebuilt exe:
esptool.exe -vv -cd none -cb 115200 -cp COM5 -ca 0x0 -cf Esp8266.ino.bin

Here are the command line parameters I'm using with the prebuilt exe:
./esptool.exe -vv -cd none -cb 115200 -cp /dev/ttyS4 -ca 0x0 -cf ./Esp8266.ino.bin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.