一、刷机环境说明
项目 | Value |
---|
电脑 | macOS Mojave版本10.14.3 | 单片机 | ESP8266-12F(集成microUSB烧录串口,2.4Gwifi) | 烧录数据线 | Kindle Paper White 3 数据线(兼具数据传输和充电与一体,nice) | microPython固件 | esp8266-1m-20200902-v1.13.bin(下载地址:https://micropython.org/download/) | 烧录软件 | NodeMCU-PyFlasher-4.0.dmg(下载地址:https://github.com/marcelstoer/nodemcu-pyflasher) |
二、刷机流程
1、下载mac烧录工具 esptool
我本机自带的python为2.7.10:
? python
Python 2.7.10 (default, Aug 17 2018, 19:45:58)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
此前,也已经安装了python3.x:
? python3
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 05:52:31)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
使用如下命令,下载烧录工具:
? micropython-1.16 pip3 install esptool
Requirement already satisfied: esptool in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Requirement already satisfied: bitstring>=3.1.6 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from esptool)
Requirement already satisfied: cryptography>=2.1.4 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from esptool)
Requirement already satisfied: ecdsa>=0.16.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from esptool)
Requirement already satisfied: pyserial>=3.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from esptool)
Requirement already satisfied: reedsolo<=1.5.4,>=1.5.3 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from esptool)
Requirement already satisfied: cffi>=1.12 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from cryptography>=2.1.4->esptool)
Requirement already satisfied: six>=1.9.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ecdsa>=0.16.0->esptool)
Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from cffi>=1.12->cryptography>=2.1.4->esptool)
You are using pip version 9.0.3, however version 21.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
? micropython-1.16
2、查询esp8266 tty串口信息
ls /dev/ 如图所示:
3、正式刷机
整个刷机时间大概持续1分钟(不像一些同学说的会耗时很久),可以接受: 刷机执行的是这条命令: esptool.py --port /dev/cu.wchusbserial1420 --baud 115200 --after no_reset write_flash --flash_mode dio 0x00000 /Users/david/Downloads/esp8266-1m-20200902-v1.13.bin --erase-all
命令执行日志如下:
Command: esptool.py --port /dev/cu.wchusbserial1420 --baud 115200 --after no_reset write_flash --flash_mode dio 0x00000 /Users/david/Downloads/esp8266-1m-20200902-v1.13.bin --erase-all
esptool.py v2.6
Serial port /dev/cu.wchusbserial1420
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 30:83:98:a3:2b:2e
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Erasing flash (this may take a while)...
Chip erase completed successfully in 9.9s
Flash params set to 0x0240
Compressed 588040 bytes to 388655...
Wrote 588040 bytes (388655 compressed) at 0x00000000 in 35.0 seconds (effective 134.5 kbit/s)...
Hash of data verified.
Leaving...
Staying in bootloader.
Firmware successfully flashed. Unplug/replug or reset device
to switch back to normal boot mode.
至此,刷机流程结束。
三、测试刷机是否成功
请根据自己机器情况,尝试连接入开发板: ? micropython-1.16 screen /dev/tty.wchusbserial1420 115200 如果看到如上效果,恭喜您,说明您的开发板esp8266-12f已经成功刷入microPython环境,请开启您的物联网探索之旅吧!
|