Chat freely about anything...

User avatar
By overkill
#20540 Hi,

I have two esptool.py, one works and the other one always makes the esp crash.

Its a ESP-12e (new nodemcu devkit)

I found that the following function is what makes it not work.

Code: Select all """ Start downloading to Flash (performs an erase) """
    def flash_begin(self, size, offset):
        old_tmo = self._port.timeout
        num_blocks = (size + ESPROM.ESP_FLASH_BLOCK - 1) / ESPROM.ESP_FLASH_BLOCK
   print 'num_blocks %08x' % num_blocks
   print 'size %08x' % size
        self._port.timeout = 10
        if self.command(ESPROM.ESP_FLASH_BEGIN,
                struct.pack('<IIII', size, num_blocks, ESPROM.ESP_FLASH_BLOCK, offset))[1] != "\0\0":
            raise Exception('Failed to enter Flash download mode')
        self._port.timeout = old_tmo


if instead of this :
Code: Select allstruct.pack('<IIII', size, num_blocks, ESPROM.ESP_FLASH_BLOCK, offset))[1] != "\0\0":

i put this :
Code: Select allstruct.pack('<IIII', size, 0x200, ESPROM.ESP_FLASH_BLOCK, offset))[1] != "\0\0":


it works no problem.

What am i doing wrong
User avatar
By tegila
#31677 Hi,

I did what you say and tried flash my Lolin V3 Black Board but don't work.
The funny part is that I started working with ESP8266 ESP12 module and all worked well.

I'm on OSX and have done many ESP-12 programming without problems.

The new parts now are the Lolin board and CH340G =\

Any new idea?

Code: Select allConnecting...
Erasing flash...
Traceback (most recent call last):
  File "/Users/tegila/workspace/backup/esptool/esptool.py", line 536, in <module>
    esp.flash_begin(blocks*esp.ESP_FLASH_BLOCK, address)
  File "/Users/tegila/workspace/backup/esptool/esptool.py", line 197, in flash_begin
    struct.pack('<IIII', size, 0x200, ESPROM.ESP_FLASH_BLOCK, offset))[1] != "\0\0":
  File "/Users/tegila/workspace/backup/esptool/esptool.py", line 111, in command
    raise Exception('Invalid response')
Exception: Invalid response