How to flash tasmota (or anything) to M5Stack ATOM Lite (ESP32-PICO-D4) using esptool?

2.2k Views Asked by At

I've tried so many things, but what is the correct way to flash a firmware to the M5Stack ATOM Lite ESP32 Development Kit using esptool? It is basically a ESP32-PICO-D4. This (among many other commands) is not working:

> esptool.py --chip auto --port /dev/ttyUSB0 --baud 115200 --before
> default_reset --after hard_reset write_flash -z --flash_mode dio
> --flash_freq 40m --flash_size detect 0x1000 ~/Downloads/tasmota32.bin

esptool.py v3.0  
Serial port /dev/ttyUSB0  
Connecting.......  
Detecting chip type... ESP32  
Chip is ESP32-PICO-D4 (revision 1)  
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None  
Crystal is 40MHz  
MAC: d8:a0:1d:5b:d1:a8  
Uploading stub...  
Running stub...  
Stub running...  
Configuring flash size...  
Auto-detected Flash size: 4MB  
Flash params set to 0x0220  
Compressed 1175280 bytes to 700387...  
Wrote 1175280 bytes (700387 compressed) at 0x00001000 in 62.9 seconds (effective 149.4 kbit/s)...  
Hash of data verified.  

Leaving...  
Hard resetting via RTS pin...  

Flashing succeeeds, but when I look at the serial monitor of the arduino IDE I get over and over

> 11:10:25.593 -> rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
> 11:10:25.593 -> configsip: 188777542, SPIWP:0xee
> 11:10:25.593 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
> 11:10:25.593 -> mode:DIO, clock div:2
> 11:10:25.593 -> load:0x3f400020,len:289900 11:10:25.958 -> ets Jun 8 2016 00:22:57
1

There are 1 best solutions below

0
On

While I'm working with an M5 board, the M5Stamp Pico, and it too uses the ESP32-PICO-D4, I recognize it's not technically the same device. None the less, perhaps this will be helpful. MACs here all replaced with zeros.

I used the below command to flash the ESP32 MicroPython firmware to the board successfully on Windows, and it is functioning as expected. I used the latest ESP32 generic firmware from https://micropython.org/download/esp32/, the v1.17.

esptool.py --chip esp32 --port com6 --baud 115200 write_flash --flash_size detect 0x1000 esp32-20210902-v1.17.bin

Board detail read:

esptool.py --port com6 --baud 115200 --after no_reset read_mac
esptool.py v3.1
Serial port com6
Connecting...
Device PID identification is only supported on COM and /dev/ serial ports.
..
Detecting chip type... ESP32
Chip is ESP32-PICO-D4 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 00:00:00:00:00:00
Uploading stub...
Running stub...
Stub running...
MAC: 00:00:00:00:00:00
Staying in bootloader.

Flash Erased

esptool.py --port com6 --baud 115200 --chip esp32 erase_flash
esptool.py v3.1
Serial port com6
Connecting...
Device PID identification is only supported on COM and /dev/ serial ports.
...
Chip is ESP32-PICO-D4 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 00:00:00:00:00:00
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 5.2s
Hard resetting via RTS pin...

MicroPython flashed successfully:

esptool.py --chip esp32 --port com6 --baud 115200 write_flash --flash_size detect 0x1000 esp32-20210902-v1.17.bin
esptool.py v3.1
Serial port com6
Connecting...
Device PID identification is only supported on COM and /dev/ serial ports.
.
Chip is ESP32-PICO-D4 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 00:00:00:00:00:00
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00001000 to 0x00175fff...
Compressed 1527504 bytes to 987584...
Wrote 1527504 bytes (987584 compressed) at 0x00001000 in 88.8 seconds (effective 137.6 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

That said, while the above does respond to your "or anything" request, I grabbed a second M5Stamp, and tried Tasmota.

I downloaded the ESP32 files from their repo to a folder: https://github.com/tasmota/install/tree/main/static/esp32

Also downloaded the Tasmota32 firmware to the same folder: http://ota.tasmota.com/tasmota32/release/tasmota32.bin

I then used their provided command from the below page, simply changing the COM port to my correct port, COM6:

https://tasmota.github.io/docs/ESP32/

with esptool.py~ Requires esptool.py 3.1 to identify new ESP chips.

With esptool.py use the following command syntax (replace COM port number!):

C:\temp\tasmota>esptool.py --chip esp32 --port COM6 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 bootloader_dout_40m.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 tasmota32.bin
esptool.py v3.1
Serial port COM6
Connecting........_
Chip is ESP32-PICO-D4 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 00:00:00:00:00:00
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00001000 to 0x00004fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x0017cfff...
Compressed 15872 bytes to 10320...
Wrote 15872 bytes (10320 compressed) at 0x00001000 in 1.1 seconds (effective 119.2 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 129...
Wrote 3072 bytes (129 compressed) at 0x00008000 in 0.1 seconds (effective 299.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 739.9 kbit/s)...
Hash of data verified.
Compressed 1492016 bytes to 889195...
Wrote 1492016 bytes (889195 compressed) at 0x00010000 in 80.0 seconds (effective 149.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Connecting to the console on COM6 at 115200bps, gave me an output indicating success. I checked WiFi networks with my phone, and saw a Tasmota SSID. I connected, used the page to select my network, and it's working as I suspect it's supposed to.