2024年7月6日 星期六

MicroPython v1.23 釋出

過去這一季都在忙 Python 爬蟲, 忘了追蹤 MicroPython 演進, 今天因為要用 Putty 連線 Mapleboard 從部落格後台看到過去幾年的 MicroPython 測試文章, 連線官網發現 v1.23 已在 6 月初釋出, 今天就拿 ESP32 與 ESP8266 各一塊來更新韌體吧. 

此版更新說明參考 :


主要的新增功能是添加了 vfs 與 tls 兩個模組, vfs 是從 os 模組分出的虛擬檔案系統模組 (但 os 裡面的還存在, 未來會被拿掉). tls 模組則是從 ssl 模組演進而來, 主要是為了安全憑證功能未來的擴充考量. 

韌體下載網址 :


燒錄程序與指令參考 :


如果沒有 esptool 套件先安裝 :

pip install esptool 

然後將板子插到 USB, 開啟裝置管理員檢查板子所連接之 COM 埠, 以下以 COM13 為例. 


一. 燒錄 ESP32 :
  1. 檢查 Flash 容量 (WROOM 為 4MB) :
    esptool --port COM13 flash_id    
  2. 抹除 Flash :
    esptool --chip esp32 --port COM13 erase_flash     
  3. 燒錄韌體 (下燒錄指令前須按住 ESP32 WROOM 板右下角的 Flash 鈕) : 
    esptool --chip esp32 --port COM13 write_flash -z 0x1000 ESP32_GENERIC-20240602-v1.23.0.bin        
注意, 請依據 USB 所連接的 COM 埠編號更改上面的 COM13, 若出現錯誤訊息可將 esptool 改成 esptool.py 試試. 


二. 燒錄 ESP8266 : 
  1. 檢查 Flash 容量 (D1 mini/Witty Cloud 為 4MB) :
    esptool --port COM13 flash_id     
  2. 抹除 Flash :
    esptool --chip esp8266 --port COM13 erase_flash    
  3. 燒錄韌體 (下燒錄指令前須按住右下角的 Flash 鈕) : 
    esptool --port COM13 --baud 115200 write_flash --flash_size=detect -fm dio 0 ESP8266_GENERIC-20240222-v1.22.2.bin       
注意, 請依據 USB 所連接的 COM 埠編號更改上面的 COM13, 若出現錯誤訊息可將 esptool 改成 esptool.py 試試. 

忙完爬蟲後真的要找個實作項目 (例如給大門口植栽定時澆水的控制器) 來複習一下 MicroPython, 不然腦筋真的會生鏽. 


2024-09-19 補充 :

今天用 ESP8266 燒錄 v1.23 韌體 : 

D:\ESP8266>esptool --port COM6 flash_id
esptool.py v4.6.2
Serial port COM6
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: e8:db:84:a8:f5:14
Uploading stub...
Running stub...
Stub running...
Manufacturer: 54
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin...

D:\ESP8266>esptool --chip esp8266 --port COM6 erase_flash
esptool.py v4.6.2
Serial port COM6
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: e8:db:84:a8:f5:14
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 10.1s
Hard resetting via RTS pin...

D:\ESP8266>esptool --port COM6 --baud 115200 write_flash --flash_size=detect -fm dio 0 ESP8266_GENERIC-20240602-v1.23.0.bin
esptool.py v4.6.2
Serial port COM6
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: e8:db:84:a8:f5:14
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00000000 to 0x0009afff...
Flash params set to 0x0240
Compressed 633048 bytes to 423611...
Wrote 633048 bytes (423611 compressed) at 0x00000000 in 37.4 seconds (effective 135.5 kbit/s)...
Hash of data verified.

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




D:\ESP32>esptool.py --port COM13 flash_id    
esptool.py v2.6
Serial port COM13
Connecting.....
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 0)
Features: WiFi, BT, Dual Core, Coding Scheme None
MAC: 00:00:00:00:00:00
Uploading stub...
Running stub...
Stub running...
Manufacturer: c8
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin...

D:\ESP32>esptool.py --chip esp32 --port COM13 erase_flash   
esptool.py v2.6
Serial port COM13
Connecting......
Chip is ESP32D0WDQ6 (revision 0)
Features: WiFi, BT, Dual Core, Coding Scheme None
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 6.1s
Hard resetting via RTS pin...

D:\ESP32>esptool.py --chip esp32 --port COM13 write_flash -z 0x1000 ESP32_GENERIC-20240602-v1.23.0.bin   
esptool.py v2.6
Serial port COM13
Connecting......
Chip is ESP32D0WDQ6 (revision 0)
Features: WiFi, BT, Dual Core, Coding Scheme None
MAC: 00:00:00:00:00:00
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 1734240 bytes to 1142447...
Wrote 1734240 bytes (1142447 compressed) at 0x00001000 in 100.9 seconds (effective 137.4 kbit/s)...
Hash of data verified.

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







沒有留言:

張貼留言