• 安装micropython到esp8266


    硬件需求:

    nodemcu / WeMosD1    (esp8266ex)

    软件:

    系统:windows/mac/linux,本人用ubuntu

    软件:python3.4+,本人3.8

    pip install adafruit-ampy

    esptool

    VSCode with "RT-Thread MicroPython" plugin

    安装esptool:

    pip install esptool

    擦除flash

    1. esptool.py --port /dev/ttyUSB1 erase_flash
    2. esptool.py v4.3
    3. Serial port /dev/ttyUSB1
    4. Connecting....
    5. Detecting chip type... Unsupported detection protocol, switching and trying again...
    6. Connecting....
    7. Detecting chip type... ESP8266
    8. Chip is ESP8266EX
    9. Features: WiFi
    10. Crystal is 26MHz
    11. MAC: e0:98:06:12:37:a8
    12. Uploading stub...
    13. Running stub...
    14. Stub running...
    15. Erasing flash (this may take a while)...
    16. Chip erase completed successfully in 11.7s
    17. Hard resetting via RTS pin...

     下载固件

    MicroPython - Python for microcontrollers

    下载最新的固件

    刷写:

    1. esptool.py --port /dev/ttyUSB1 --baud 460800 write_flash --flash_size=detect 0 esp8266-20220618-v1.19.1.bin
    2. esptool.py v4.3
    3. Serial port /dev/ttyUSB1
    4. Connecting....
    5. Detecting chip type... Unsupported detection protocol, switching and trying again...
    6. Connecting....
    7. Detecting chip type... ESP8266
    8. Chip is ESP8266EX
    9. Features: WiFi
    10. Crystal is 26MHz
    11. MAC: e0:98:06:12:37:a8
    12. Uploading stub...
    13. Running stub...
    14. Stub running...
    15. Changing baud rate to 460800
    16. Changed.
    17. Configuring flash size...
    18. Auto-detected Flash size: 4MB
    19. Flash will be erased from 0x00000000 to 0x0009afff...
    20. Flash params set to 0x0040
    21. Compressed 634844 bytes to 419808...
    22. Wrote 634844 bytes (419808 compressed) at 0x00000000 in 9.5 seconds (effective 532.2 kbit/s)...
    23. Hash of data verified.
    24. Leaving...
    25. Hard resetting via RTS pin...

    使用ampy上传下载程序

    ampy -p /dev/ttyUSB0 ls
    /boot.py
    ampy支持的命令:

    • get  从开发版下载文件ampy -p /dev/ttyUSB0 get boot.py
    • ls  list所有开发板文件
    • mkdir 在开发板创建文件夹
    • reset 开发板软件重置
    • rmdir 删除文件夹
    • run 运行脚本并输出

    运行一个示例

    (base) ping@ping:~/.vscode/extensions/rt-thread.rt-thread-micropython-1.0.11/microExamples/examples/03.board/3.esp8266$ ampy -p /dev/ttyUSB0 put blink.py 
    (base) ping@ping:~/.vscode/extensions/rt-thread.rt-thread-micropython-1.0.11/microExamples/examples/03.board/3.esp8266$ ampy -p /dev/ttyUSB0 run blink.py
     

    因为RT-thread 插件无法找到串口,所以用ampy上传和运行了。

  • 相关阅读:
    使用Vagrant创建和管理本地Kubernetes(K8s)集群的步骤是什么
    24届近3年河海大学自动化考研院校
    tsne 学习使用
    省市区三级联动
    Sublime Text3 最简单的修改字体的方法
    mac 升级node到指定版本
    新建SpringCloud电商前端Vant项目
    数据结构 堆 heap
    记一次 .NET某机械臂上位系统 卡死分析
    创建型设计模式之工厂方法模式
  • 原文地址:https://blog.csdn.net/u011995159/article/details/127696774