micropython入门及固件刷入
物联网 micropython
2020年6月17日

介绍

MicroPython极精简高效的实现了Python3语言。它包含Python标准库的一小部分,能在单片机和受限环境中运行。

官方网站:https://micropython.org/

设备

  • NodeMCU ESP8266

安装esptool

pip install esptool

连接开发板后,查看tty端口

# 我使用是macos,windows串口应该是COM开头的
╰─$ ls /dev/tty.*
/dev/tty.Bluetooth-Incoming-Port /dev/tty.usbserial-14710

清空当前系统

╰─$ esptool.py --port /dev/tty.usbserial-14710 erase_flash
esptool.py v2.8
Serial port /dev/tty.usbserial-14710
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 48:3f:da:66:83:e9
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 11.3s

刷入micropython

固件下载地址:http://micropython.org/download/esp8266/

esptool.py --port /dev/tty.usbserial-14710 --baud 460800 write_flash --flash_size=detect -fm dio 0 Downloads/esp8266-20191220-v1.12.bin
esptool.py v2.8
Serial port /dev/tty.usbserial-14710
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 48:3f:da:66:83:e9
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0240
Compressed 619828 bytes to 404070...
Wrote 619828 bytes (404070 compressed) at 0x00000000 in 10.1 seconds (effective 492.2 kbit/s)...
Hash of data verified.

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

使用thonny连接开发板

thonny官方地址:https://thonny.org/

E4t4s0

检查固件

a7HNY1

最后修改于: 2023年8月9日 17:05