M5Stack Flow flashing on Linux

This post has been updated - I found some errors which don’t brick devices, but cause issues with wifi. Don’t use old versions of esptool!

This is a pretty sparse example but it got me working on my Ubuntu machine.

  1. Install esptool from pip - don’t use the one from apt, as of this writing it’s v2.1, where pip has v2.6. The command is pip install esptool
  2. Download the M5Flow MacOS version from http://flow.m5stack.com/- M5Burner_MacOS.zip in my example.
  3. Grab the firmware directory from the zip file and move it to Documents (for example):
    • cd $(mktemp -d)
    • unzip ~/Downloads/M5Burner_MacOS.zip 'M5Burner_MacOS.app/Contents/Resources/firmware/M5Flow/*
    • mv M5Burner_MacOS.app/Contents/Resources/firmware/M5Flow/ ~/Documents
  4. This’ll give you the firmware folder with a bunch of version in it, eg M5Flow/v1.1.1-en
  5. cd ~/Documents/M5Flow/v1.1.1-en
  6. Plug the M5Stack in, and then run ./flash.sh
  7. This’ll reboot the device a few times until it’s in bootloader/flashing mode, then upload the firmware.
  8. Once it’s done, tap the power button to reboot into the new firmware.

Below is the output when it can’t identify the device and is going to do it wrong. The important part is the “unknown” in Chip is ESP32D0WDQ6 (revision (unknown 0xa)).


$ cd ~/Documents/M5Flow/v1.1.1-en
$ sed -i.bak 's/esptool\.py/esptool/g flash.sh
$ ./flash.sh 
linux
esptool.py v2.1
Connecting........_____....._____....._____..
Chip is ESP32D0WDQ6 (revision (unknown 0xa))
Changing baud rate to 921600
Changed.
Enabling default SPI flash mode...
Configuring flash size...
Auto-detected Flash size: 4MB
Erasing flash...
Compressed 19328 bytes to 12060...
Took 0.17s to erase flash block
Wrote 19328 bytes (12060 compressed) at 0x00001000 in 0.3 seconds (effective 492.5 kbit/s)...
Hash of data verified.
Erasing flash...
Compressed 144 bytes to 69...
Took 0.04s to erase flash block
Wrote 144 bytes (69 compressed) at 0x0000f000 in 0.1 seconds (effective 9.8 kbit/s)...
Hash of data verified.
Erasing flash...
Compressed 1377744 bytes to 874230...
Took 3.49s to erase flash block
Wrote 1377744 bytes (874230 compressed) at 0x00010000 in 19.8 seconds (effective 556.1 kbit/s)...
Hash of data verified.
Erasing flash...
Compressed 3072 bytes to 127...
Took 0.04s to erase flash block
Wrote 3072 bytes (127 compressed) at 0x00008000 in 0.1 seconds (effective 215.1 kbit/s)...
Hash of data verified.
Erasing flash...
Compressed 2686976 bytes to 946336...
Took 3.14s to erase flash block
Wrote 2686976 bytes (946336 compressed) at 0x00170000 in 24.7 seconds (effective 868.9 kbit/s)...
Hash of data verified.

Leaving...
Staying in bootloader.
$ 

Here’s the version with it working… not a huge difference but I guess something’s slightly wrong in earlier esptool versions.

linux
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: 80:7d:3a:dc:b1:d8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 19328 bytes to 12060...
Wrote 19328 bytes (12060 compressed) at 0x00001000 in 0.2 seconds (effective 959.5 kbit/s)...
Hash of data verified.
Compressed 144 bytes to 69...
Wrote 144 bytes (69 compressed) at 0x0000f000 in 0.0 seconds (effective 466.6 kbit/s)...
Hash of data verified.
Compressed 1377744 bytes to 874230...
Wrote 1377744 bytes (874230 compressed) at 0x00010000 in 13.6 seconds (effective 807.8 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 127...
Wrote 3072 bytes (127 compressed) at 0x00008000 in 0.0 seconds (effective 8640.3 kbit/s)...
Hash of data verified.
Compressed 2686976 bytes to 946336...
Wrote 2686976 bytes (946336 compressed) at 0x00170000 in 19.5 seconds (effective 1099.9 kbit/s)...
Hash of data verified.

Leaving...
Staying in bootloader.


#m5stack #linux #ubuntu