Weird flashing failure

RobinC
Posts: 45
Joined: Sat Feb 04, 2017 5:29 pm

Weird flashing failure

Postby RobinC » Wed Jun 07, 2017 5:16 pm

I modified the ethernet example to add the MAC address when printing out IP info for the interface. It now fails to flash.

The code:

Code: Select all

                esp_eth_get_mac(mac);
                ESP_LOGI(TAG, "~~~~~~~~~~~");
                ESP_LOGI(TAG, "ETHIP:"IPSTR, IP2STR(&ip.ip));
                ESP_LOGI(TAG, "ETHPMASK:"IPSTR, IP2STR(&ip.netmask));
                ESP_LOGI(TAG, "ETHPGW:"IPSTR, IP2STR(&ip.gw));
                ESP_LOGI(TAG, "ETHMAC: %02x:%02x:%02x:%02x:%02x:%02x",
                    mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
                ESP_LOGI(TAG, "~~~~~~~~~~~");
The make flash fails (always at 57%):

Code: Select all

robin@u64imac:~/esp/esp-idf/examples/ethernet/ethernet$ make flash monitor
CC ethernet_main.o
AR libmain.a
LD ethernet_demo.elf
esptool.py v2.0-beta1
Flashing binaries to serial port /dev/ttyACM0 (app at offset 0x10000)...
esptool.py v2.0-beta1
Connecting.........
Uploading stub...
Running stub...
Stub running...
Attaching SPI flash...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0220
Compressed 11616 bytes to 6709...
Wrote 11616 bytes (6709 compressed) at 0x00001000 in 0.8 seconds (effective 120.4 kbit/s)...
Hash of data verified.
Compressed 475296 bytes to 220183...
Writing at 0x0002c000... (57 %)
A fatal error occurred: Timed out waiting for packet header
/home/robin/esp/esp-idf/components/esptool_py/Makefile.projbuild:52: recipe for target 'flash' failed
make: *** [flash] Error 2
If I change the line:

Code: Select all

                ESP_LOGI(TAG, "ETHMAC: %02x:%02x:%02x:%02x:%02x:%02x",
To:

Code: Select all

                ESP_LOGI(TAG, "ETHMAC: %02x:%02x:%02x:%02x:%02x %02x",
Or to:

Code: Select all

                ESP_LOGI(TAG, "ETHMAC: %02x:%02x:%02x:%02x:%02x:%02xX",
It flashes fine and works. I can also add two spaces (not just one) to the end of the format line and it works.

Is there a sequence of characters in the flashing process that will cause issues? This is doubly weird since the flashed file is compressed.

Robin

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Weird flashing failure

Postby ESP_Angus » Thu Jun 08, 2017 1:47 am

Hi Robin,

That's quite strange!

There is one known bug still pending a fix that could possibly be the same as this, where a binary which contains a lot of compressible data (in that case, a large buffer of repeating characters) is too slow to flash:
https://github.com/espressif/esptool/issues/183

In this case the compression ratio is less extreme, though. Still, it may be related to the compression algorithm: If you disable compression in the esptool upload (you can do this via menuconfig, or pass the --no-compress argument to esptool.py, does the bug go away?

You could also try the workaround mentioned at the issue link above, of increasing the esptool.py internal response timeout.

Finally, would it be possible for you to privately send me the working & not working .bin files for analysis?

Angus

RobinC
Posts: 45
Joined: Sat Feb 04, 2017 5:29 pm

Re: Weird flashing failure

Postby RobinC » Thu Jun 08, 2017 2:07 pm

I turned off compression and the bad image loads and runs. That seems to be the issue.

I sent a PM with links to the images.

Robin

Who is online

Users browsing this forum: No registered users and 158 guests