>>> import upip
>>> upip.install('picoweb')
Installing to: /lib/
Warning: micropython.org SSL certificate is not validated
Error installing 'picoweb': memory allocation failed, allocating 8238 bytes, packages may be partially installed
即使匯入 gc 模組來手動回收垃圾也一樣 :
>>> import gc
>>> gc.collect()
>>> upip.install('picoweb')
Installing to: /lib/
Error installing 'picoweb': memory allocation failed, allocating 8238 bytes, packages may be partially installed
說實在的也沒啥垃圾好清, 因為我上傳的 boot.py 裡面只有下面四個連網指令, 連 webrepl 也沒開啟 :
#boot.py
#import esp
#esp.osdebug(None)
#import webrepl
#webrepl.start()
import network
sta=network.WLAN(network.STA_IF)
sta.active(True)
sta.connect('TonyNote8', 'blablabla')
匯入 micropython 模組來檢視記憶體大小, 發現可用記憶體還不到 20KB :
>>> import micropython
>>> micropython.mem_info()
stack: 2112 out of 8192
GC: total: 37952, used: 18128, free: 19824
No. of 1-blocks: 122, 2-blocks: 23, max blk sz: 515, max free sz: 677
韌體是官方 v1.11 最新版, 而且是一開機 boot.py 連網成功後馬上安裝 picoweb. 如果是 NodeMCU-32S 開發板, 其 SRAM 記憶體就很多了, 至少都有 110KB :
>>> import micropython
>>> micropython.mem_info()
stack: 736 out of 15360
GC: total: 120192, used: 10160, free: 110032
No. of 1-blocks: 114, 2-blocks: 28, max blk sz: 264, max free sz: 6569
看來 picoweb 只能在 ESP32 具有較多記憶體的板子上才能跑了.
所以我又找出 bpi::bit 開發板 (又稱 Webduino), 裡面灌的是 bpi::bit 版的 MicroPython 韌體, 連上 Internet 後安裝 picoweb 卻出現 '[Errno 12] ENOMEM' 錯誤訊息 :
>>> wifi.wlan.connect('TonyNote8','blablabla')
>>> wifi.wlan.ifconfig()
('192.168.43.114', '255.255.255.0', '192.168.43.1', '192.168.43.1')
>>> import upip
>>> upip.install('picoweb')
Installing to: /lib/
Error installing 'picoweb': [Errno 12] ENOMEM, packages may be partially installed
或者出現 'list index out of range' 錯誤訊息 :
>>> upip.install('picoweb')
Installing to: /lib/
Error installing 'picoweb': list index out of range, packages may be partially installed
總之, 這幾天測試 picoweb 的結論是 : 只有 ESP32 板子有夠大的記憶體能安裝 picoweb (ESP8266 不行). MicroPython 官方韌體 OK, 而 bpi::bit 的韌體目前還不行.
2 則留言 :
Hello,
I try to install Picoweb on my ESP espressif DEV V4 ESP32 with the last Firmware
https://micropython.org/resources/firmware/esp32-idf4-20200327-v1.12-310-g9418611c8.bin
My esp32 is connected to internet, no problem.
But here is the issue.
upip.install('picoweb')
Installing to: /lib/
mbedtls_ssl_handshake error: -71
Error installing 'picoweb': [Errno 5] EIO, packages may be partially installed
Could you help me to install Picoweb on ESP32.
Thanks to help me.
Regards.
julien.launay@laposte.net
Hi, Julien :
You can install uasyncio & pkg_resources first :
upip.install('micropython-uasyncio')
upip.install('micropython-pkg_resources')
Please refer to :
https://yhhuang1966.blogspot.com/2019/07/micropython-on-esp32-upip-picoweb-2.html
張貼留言