前陣子曾用 esptool.py 燒錄過跟 NodeMCU 很像的 Wemos ESP8266 開發板, 但還沒用它來燒錄 D1 mini, 兩者差別是 Wemos ESP8266 有 Flash 按鈕, 燒錄前要按住, 燒錄開始後可放開, 參考 :
D1 mini 沒有 Flash 按鈕 (板上只有一個 Reset 鈕), 用 esptool.py 查詢或燒錄前要用一條杜邦線將 D4 (GPIO0) 腳接地, 燒錄完再移除 :
將 D4 接地後開啟命令提示字元視窗, 切換到映像檔所在資料夾 :
C:\Users\User>d:
D:\>cd esp8266
1. 查詢 D1 mini 的 Flash 大小 :
D:\ESP8266>esptool.py --port COM8 flash_id
esptool.py v2.6
Serial port COM8
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 60:01:94:23:b4:b6
Uploading stub...
Running stub...
Stub running...
Manufacturer: c8
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin...
2. 抹除 Flash 記憶體內容 :
D:\ESP8266>esptool.py --chip esp8266 --port COM8 erase_flash
esptool.py v2.6
Serial port COM8
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: 60:01:94:23:b4:b6
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 6.0s
Hard resetting via RTS pin...
3. 燒錄 MicroPython 韌體 (v1.18 版) :
D:\ESP8266>esptool.py --port COM8 --baud 115200 write_flash --flash_size=detect -fm dio 0 esp8266-20220117-v1.18.bin
esptool.py v2.6
Serial port COM8
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 60:01:94:23:b4:b6
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0240
Compressed 635992 bytes to 418428...
Wrote 635992 bytes (418428 compressed) at 0x00000000 in 36.7 seconds (effective 138.5 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
D:\ESP8266>
這樣就成功燒錄映像檔了, 拔除 D4 接腳的接地線, 用 Putty 連線 D1 mini 所在 COM 埠, 按 Reset 鈕或 Ctrl + B (可能要兩次) 即可看到 MicroPython REPL 介面了 :
MicroPython v1.18 on 2022-01-17; ESP module with ESP8266
Type "help()" for more information.
>>> print('Hello World!')
Hello World!
>>>
沒有留言:
張貼留言