Page 1 of 1

Problems with downloading flash

Posted: Thu Feb 04, 2016 4:17 pm
by adamj57
Hi,

I have problem with uploading test project to ESP. When I execute that command:

Code: Select all

./esptool32.py -p /dev/ttyUSB0 -b 115200 write_flash -ff 40m -fm qio -fs 2m 0x0 boot.bin 0x04000 irom1.bin 0x40000 irom0_flash.bin 0xFC000 blank.bin
I'm getting this output:

Code: Select all

Connecting...
Erasing flash...
Erase size 1800 num_blocks 6 offset 0
Traceback (most recent call last):
  File "./esptool32.py", line 611, in <module>
    esp.flash_begin(blocks*esp.ESP_FLASH_BLOCK, address)
  File "./esptool32.py", line 229, in flash_begin
    struct.pack('<IIII', erase_size, num_blocks, ESPROM.ESP_FLASH_BLOCK, offset))
  File "./esptool32.py", line 121, in command
    raise Exception('Invalid head of packet')
Exception: Invalid head of packet
ESP's pin GPIO0 is pulled down, it boots in mode 11. What I did wrong?

Thanks for help! :)

Re: Problems with downloading flash

Posted: Thu Feb 04, 2016 7:30 pm
by captain_morgan
I recall seeing that error but cannot remember exactly in what context.

Are you using esptool32 from this comment? http://esp32.com/viewtopic.php?f=2&t=22#p191
That has a couple of fixes.

Re: Problems with downloading flash

Posted: Fri Feb 05, 2016 12:10 pm
by adamj57
Yes, I'm using that version. read_mac is working without any problems:

Code: Select all

root@adamj57:/media/sf_SHARED_UBUNTU# ./esptool32.py --port /dev/ttyUSB0 --baud 115200 read_mac
Connecting...
MAC: 18:fe:34:00:00:ff 
...but any other command don't:

Code: Select all

root@adamj57:/media/sf_SHARED_UBUNTU# ./esptool32.py --port /dev/ttyUSB0 --baud 115200 read_flash 0x0 0x40000 test.bin
Connecting...
Please wait...
Erase size 0 num_blocks 0 offset 0
Traceback (most recent call last):
  File "./esptool32.py", line 697, in <module>
    file(args.filename, 'wb').write(esp.flash_read(args.address, 1024, div_roundup(args.size, 1024))[:args.size])
  File "./esptool32.py", line 287, in flash_read
    self.flash_begin(0, 0)
  File "./esptool32.py", line 229, in flash_begin
    struct.pack('<IIII', erase_size, num_blocks, ESPROM.ESP_FLASH_BLOCK, offset))
  File "./esptool32.py", line 121, in command
    raise Exception('Invalid head of packet')
Exception: Invalid head of packet
Pulling GPIO2 down doesn't change anything. Soldering is done right (at least, I think so).

Re: Problems with downloading flash

Posted: Tue Jun 07, 2016 6:29 am
by jmattsson
Hi,

Did you ever resolve this problem? I'm finding myself in the same situation where I can read the MACs successfully, but any command involving the flash chip times out. Would love to find a resolution... I've tried three different esptool.py versions, plus augmenting the SDK-provided one to try to resync after sending the ESP_FLASH_BEGIN command, all to no avail.

When I'm not booting into programming mode (boot mode 13), I get regular output like this:

Code: Select all

ets Jul  5 2015,rst cause:9, boot mode:(33)

	 _stack_sentry: 0x3fffe1d0, 	 __stack: 0x40000000, 
 	 _bss_start: 0x3fffcd48, 	 _bss_end: 0x3fffe1d0, 
 	 _data_start: 0x3fffc000, 	 _data_end: 0x3fffc864 
As far as I can tell by probing out the various pins, the flash chip is simply not responding to the read-status command it gets sent.

Re: Problems with downloading flash

Posted: Tue Jun 14, 2016 8:58 am
by jmattsson
So one of the issues was that this module had a short between pin19 VDDPST and pin18 MTDI. It turns out that if you pull MTDI high during reset, it makes the ESP32 use 1.8V I/O towards the SPI chip (possibly elsewhere too), rather than the regular 3.3V. This explained why the flash chip was never getting ready.

Having painstakingly cleaned up the solder around pin19 on the ESP chip itself to remove the short, the flash chip is finally responding. I am still unable to flash the ESP32 though, as it now gets stuck on the FLASH_BEGIN command whenever said command has a non-zero erase size. FLASH_BEGIN with a zero erase size does get a response. Does anyone have any bright ideas on what I need to fix next?

In case it is relevant, the output during attempted boot now looks like this:

Code: Select all

 ets Jul  5 2015,rst cause:9, boot mode:(37)

	 _stack_sentry: 0x3fffe1d0, 	 __stack: 0x40000000, 
 	 _bss_start: 0x3fffcd48, 	 _bss_end: 0x3fffe1d0, 
 	 _data_start: 0x3fffc000, 	 _data_end: 0x3fffc864 
load 0x40040000, len 3784, room 16
tail 8
chksum 0x90
load 0xffffffff, len -1, room 0

Re: Problems with downloading flash

Posted: Fri Jun 17, 2016 1:13 am
by jmattsson
Just to finalise my apparent monologue here:

The actual flash chip was defective. Quite possibly because it had been fed 1.8V due to the aforementioned short. After lifting a flash chip from an ESP12 module and using that as a replacement I've finally been able to flash this ESP32.

Better documentation on which pins are used for what during boot would have saved us a ton of trouble. Hint hint, nudge nudge.

And whatever you design with these modules, don't put a pull-up on MTDI in your designs unless you're intending to run with 1.8V I/O!