microPython环境安装及使用

1.ESP8266_12E(NodeMCU1.0)(AI Thinker)板Arduino IDE环境安装

(1)方法1(自动安装,windows,mac,linux平台都可)
http://arduino.esp8266.com/stable/package_esp8266com_index.json
(2)方法2(手工安装库和工具,mac,linux)
(a)cd hardware
(b)mkdir esp8266com
(c)cd esp8266com
(d)git clone https://github.com/esp8266/Arduino.git esp8266
(e)cd esp8266/tools
(f)python2.7 get.py

2.EESP8266_12E(NodeMCU1.0)(AI Thinker)板micropythons固件写入与使用

(1)安装烧写固件工具:pip install esptool
(2)烧写固件
(a) 下载固件(micropython.org): esp8266-20171101-v1.9.3.bin
(b) 清flash: esptool.py --port /dev/tty.SLAB_USBtoUART erase_flash
(c) 写固件:esptool.py --port /dev/tty.SLAB_USBtoUART --baud 115200 write_flash --flash_size=detect 0 esp8266-20171101-v1.9.3.bin
就有wifi啦!!!是AP, ssid=micropyth-xxx 密码:micropythoN
(d) windows环境:esptool安装到python2\Scripts\目录下,运行 c:\python27\scripts\esptool.py
esptool.py -h
(4)使用工具
(a)rshell(!可双向传送文件,!支持repl, windows,mac,linux平台)
(b)webrepl(!只双向传送文件,!支持windows,mac,linux平台)
(c)putty(!只支持repl,!支持windows,mac,linux平台)

3 ESP32 Arduino安装

(1)方法1(自动安装, windows,mac,linux平台都可):
http://arduino.esp8266.com/stable/package_esp8266com_index.json
(2)方法2(手工安装库和工具)

4 ESP32 micropythons固件写入

(1) 安装烧写固件工具:
pip install esptool
(2) 烧写固件
* 下载固件:esp32-20171204-v1.9.2-445-g84035f0f.bin
* 清flash: esptool.py --port /dev/tty.SLAB_USBtoUART erase_flash
* 写固件:esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART write_flash -z 0x1000 /Users/romh/downloads/esp32-20171204-v1.9.2-445-g84035f0f.bin
(3)使用
* rshell(!可双向传送文件,!支持repl,!只mac,linux平台)
* 当前(2017.10) 不支持webrepl

* putty(!只支持repl,!支持windows,mac,linux平台)

5 PYB1.0,PYB1.1固件写入

windows平台用DfuSe_Demo_V3.0.2,略。
linux平台安装如下
install dfu-util
sudo dfu-util --alt 0 -D pybv10-network-20161110-v1.8.6.dfu
写新片micropython固件用ST-link编程器。
有micropython固件后,可以用这个工具升级。
putty or TeraTerm连接使用。

!rshell也可以用。

6 终端调试工具()

(1)rshell(功能强大,!可双向传送文件,!支持repl,windows,mac,linux平台)
(a)安装rshell
sudo pip3 install rshell

https://github.com/dhylands/rshell
(b)使用rshell
<1> 帮助
rshell -help
<2> 连接ESP目标板
rshell --buffer-size=30 -p /dev/tty.SLAB_USBtoUART

cp somefile.py /flash
repl ~ pyb.bootloader() ~
repl
ctrl_x, ctrl_c
传送二进制文件有问题?
(2)网页webrepl
下载后,点击其中的html文件 !可传送文件,可webrepl命令。
(3)命令行webrepl
下载后,python3下用webrepl_cli.py命令行方式, !只可传送文件。

(4)安装putty(mac安装太多内容,时间长,不建议用。windows平台很小,建议用。!只有repl)
* 安装xcode
* 安装MacPorts
* suod port install putty
https://www.xquartz.org
* cp /opt/local/bin/putty ~/Desktop/PuTTY

微信:h790516
qq :790516
博客:http://www.cnblogs.com/hyper99
微店:嵌入式系统工匠坊 ---http://wd.koudai.com/s/259792644
作者:黄永平(Hyper)
时间:2017年12月7日

posted @ 2017-12-12 00:00  hyper99  阅读(9172)  评论(0编辑  收藏  举报