Error when flashing ESP32 - Testing if ubinascii.unhexlify exists ...

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
theMusicMan
Posts: 23
Joined: Mon Feb 11, 2019 12:16 am

Re: Error when flashing ESP32 - Testing if ubinascii.unhexlify exists ...

Post by theMusicMan » Fri Feb 15, 2019 4:21 pm

Thought I'd drop a reply in here to update.

After much to'ing and fro'ing using my two existing ESP8266's, I decided to purchase two new ones. The news is that the two new ESP8266's worked perfectly first time with the process of erase_flash, write_flash, rshell, REPL - without seeing the dreaded error above.

So all I can think of is that there may be a hardware issue re flashing MicroPython to older (2.5-3 yr old) ESP8266's. That's all I can think of.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Error when flashing ESP32 - Testing if ubinascii.unhexlify exists ...

Post by pythoncoder » Mon Feb 18, 2019 2:01 pm

Some ESP8266 boards require special esptool args. I have found the following -fm values to work on some hardware:

esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --verify --flash_size=8m -fm qio 0 build/firmware-combined.bin

esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --verify --flash_size=detect -fm dout 0 build/firmware-combined.bin
Peter Hinch
Index to my micropython libraries.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Error when flashing ESP32 - Testing if ubinascii.unhexlify exists ...

Post by Roberthh » Mon Feb 18, 2019 5:02 pm

I cannot tell if anybody has asked that yet, but which type, version and flash size are the ESP8266 boards that fail?

theMusicMan
Posts: 23
Joined: Mon Feb 11, 2019 12:16 am

Re: Error when flashing ESP32 - Testing if ubinascii.unhexlify exists ...

Post by theMusicMan » Mon Feb 18, 2019 6:51 pm

pythoncoder wrote:
Mon Feb 18, 2019 2:01 pm
Some ESP8266 boards require special esptool args. I have found the following -fm values to work on some hardware:

esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --verify --flash_size=8m -fm qio 0 build/firmware-combined.bin

esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --verify --flash_size=detect -fm dout 0 build/firmware-combined.bin
Thanks for the suggestion pythoncoder; tried these and alas, still the same results when I try to run rshell.
Roberthh wrote:
Mon Feb 18, 2019 5:02 pm
I cannot tell if anybody has asked that yet, but which type, version and flash size are the ESP8266 boards that fail?
One is a Wemos Pro Mini - and the write flash gives this...

Code: Select all

esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash --verify --flash_size=detect -fm dout 0 Desktop/esp8266-20190125-v1.10.bin
esptool.py v2.6
Serial port /dev/cu.SLAB_USBtoUART
Connecting........_
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 5c:cf:7f:d9:60:45
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 16MB
Flash params set to 0x0390
Compressed 615388 bytes to 399928...
Wrote 615388 bytes (399928 compressed) at 0x00000000 in 35.2 seconds (effective 140.0 kbit/s)...
Hash of data verified.

Leaving...
Verifying just-written flash...
(This option is deprecated, flash contents are now always read back after flashing.)
Flash params set to 0x0390
Verifying 0x963dc (615388) bytes @ 0x00000000 in flash against Desktop/esp8266-20190125-v1.10.bin...
-- verify OK (digest matched)
Hard resetting via RTS pin...
john@Mac-82:~$ 
The other one is a NodeMCU 8266, and the write flash command for this one gives...

Code: Select all

esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash --verify --flash_size=detect -fm dout 0 Desktop/esp8266-20190125-v1.10.bin
esptool.py v2.6
Serial port /dev/cu.SLAB_USBtoUART
Connecting........_
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 5c:cf:7f:39:d4:60
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0340
Compressed 615388 bytes to 399928...
Wrote 615388 bytes (399928 compressed) at 0x00000000 in 35.3 seconds (effective 139.5 kbit/s)...
Hash of data verified.

Leaving...
Verifying just-written flash...
(This option is deprecated, flash contents are now always read back after flashing.)
Flash params set to 0x0340
Verifying 0x963dc (615388) bytes @ 0x00000000 in flash against Desktop/esp8266-20190125-v1.10.bin...
-- verify OK (digest matched)
Hard resetting via RTS pin...

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Error when flashing ESP32 - Testing if ubinascii.unhexlify exists ...

Post by Roberthh » Mon Feb 18, 2019 7:09 pm

On the Wemos Pro mini, you could to set the flash size during loading to 4 MByte, since Micropython does not support more. There is a method for that, but it's not part of the standard procedure.

theMusicMan
Posts: 23
Joined: Mon Feb 11, 2019 12:16 am

Re: Error when flashing ESP32 - Testing if ubinascii.unhexlify exists ...

Post by theMusicMan » Mon Feb 18, 2019 7:15 pm

Roberthh wrote:
Mon Feb 18, 2019 7:09 pm
On the Wemos Pro mini, you could to set the flash size during loading to 4 MByte, since Micropython does not support more. There is a method for that, but it's not part of the standard procedure.
Thanks Robert... so would the syntax for this be...

Code: Select all

esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash --verify --flash_size=4000 -fm dout 0 Desktop/esp8266-20190125-v1.10.bin
Thanks...

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Error when flashing ESP32 - Testing if ubinascii.unhexlify exists ...

Post by Roberthh » Mon Feb 18, 2019 8:19 pm

It's
--flash_size 4MB

theMusicMan
Posts: 23
Joined: Mon Feb 11, 2019 12:16 am

Re: Error when flashing ESP32 - Testing if ubinascii.unhexlify exists ...

Post by theMusicMan » Mon Feb 18, 2019 8:33 pm

Roberthh wrote:
Mon Feb 18, 2019 8:19 pm
It's
--flash_size 4MB
Hey Robert... I owe you a beer! or wine! or gin!

Well, well well... would you believe it... this command...
esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash --verify --flash_size=4MB -fm dout 0 Desktop/esp8266-20190125-v1.10.bin
...actually worked on the Wemos D1 Mini Pro AND on the NodeMCu!!!!!

After all this... posts on loads of forums, dozens of attempts... and it comes down to '4MB' :)

Thanks a million Robert, much appreciated sir. :D I now have two additional ESP8266's I need to put to good use.

On to trying to get the temp and humidity data extracted from data packets on the SONOFF TH10 I've just bought... life's one great challenge for us eh :)

Post Reply