PageRenderTime 39ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/esp8266/README.md

https://gitlab.com/jiangming1399/micropython-mirror
Markdown | 122 lines | 96 code | 26 blank | 0 comment | 0 complexity | 64bf58405ae2a37c6c64b2e0080411c4 MD5 | raw file
  1. MicroPython port to ESP8266
  2. ===========================
  3. This is an experimental port of MicroPython for the WiFi modules based
  4. on Espressif ESP8266 chip.
  5. WARNING: The port is experimental and many APIs are subject to change.
  6. Supported features include:
  7. - REPL (Python prompt) over UART0.
  8. - Garbage collector, exceptions.
  9. - Unicode support.
  10. - Builtin modules: gc, array, collections, io, struct, sys, esp, network,
  11. many more.
  12. - Arbitrary-precision long integers and 30-bit precision floats.
  13. - WiFi support.
  14. - Sockets using modlwip.
  15. - GPIO and bit-banging I2C, SPI support.
  16. - 1-Wire and WS2812 (aka Neopixel) protocols support.
  17. - Internal filesystem using the flash.
  18. - WebREPL over WiFi from a browser (clients at https://github.com/micropython/webrepl).
  19. - Modules for HTTP, MQTT, many other formats and protocols via
  20. https://github.com/micropython/micropython-lib .
  21. Work-in-progress documentation is available at
  22. http://docs.micropython.org/en/latest/esp8266/ .
  23. Build instructions
  24. ------------------
  25. The tool chain required for the build is the OpenSource ESP SDK, which can be
  26. found at <https://github.com/pfalcon/esp-open-sdk>. Clone this repository and
  27. run `make` in its directory to build and install the SDK locally. Make sure
  28. to add toolchain bin directory to your PATH. Read esp-open-sdk's README for
  29. additional important information on toolchain setup.
  30. Add the external dependencies to the MicroPython repository checkout:
  31. ```bash
  32. $ git submodule update --init
  33. ```
  34. See the README in the repository root for more information about external
  35. dependencies.
  36. The MicroPython cross-compiler must be built to pre-compile some of the
  37. built-in scripts to bytecode. This can be done using:
  38. ```bash
  39. $ make -C mpy-cross
  40. ```
  41. Then, to build MicroPython for the ESP8266, just run:
  42. ```bash
  43. $ cd esp8266
  44. $ make axtls
  45. $ make
  46. ```
  47. This will produce binary images in the `build/` subdirectory. If you install
  48. MicroPython to your module for the first time, or after installing any other
  49. firmware, you should erase flash completely:
  50. ```
  51. esptool.py --port /dev/ttyXXX erase_flash
  52. ```
  53. Erase flash also as a troubleshooting measure, if a module doesn't behave as
  54. expected.
  55. To flash MicroPython image to your ESP8266, use:
  56. ```bash
  57. $ make deploy
  58. ```
  59. This will use the `esptool.py` script to download the images. You must have
  60. your ESP module in the bootloader mode, and connected to a serial port on your PC.
  61. The default serial port is `/dev/ttyACM0`. To specify another, use, eg:
  62. ```bash
  63. $ make PORT=/dev/ttyUSB0 deploy
  64. ```
  65. The image produced is `firmware-combined.bin`, to be flashed at 0x00000.
  66. First start
  67. -----------
  68. __Serial prompt__
  69. You can access the REPL (Python prompt) over UART (the same as used for
  70. programming).
  71. - Baudrate: 115200
  72. __WiFi__
  73. Initally, the device configures itself as a WiFi access point (AP).
  74. - ESSID: MicroPython-xxxxxx (xs are replaced with part of the MAC address).
  75. - Password: micropythoN (note the upper-case N).
  76. - IP address of the board: 192.168.4.1.
  77. - DHCP-server is activated.
  78. __WebREPL__
  79. Python prompt over WiFi, connecting through a browser.
  80. - Hosted at http://micropython.org/webrepl.
  81. - GitHub repository https://github.com/micropython/webrepl.
  82. Please follow the instructions there.
  83. More detailed instructions can be found at
  84. http://docs.micropython.org/en/latest/esp8266/esp8266/tutorial/intro.html
  85. Troubleshooting
  86. ---------------
  87. While the port is still in alpha, it's known to be generally stable. If you
  88. experience strange bootloops, crashes, lockups, here's a list to check against:
  89. - You didn't erase flash before programming MicroPython firmware.
  90. - Firmware can be occasionally flashed incorrectly. Just retry. Recent
  91. esptool.py versions have --verify option.
  92. - Power supply you use doesn't provide enough power for ESP8266 or isn't
  93. stable enough.
  94. - A module/flash may be defective (not unheard of for cheap modules).
  95. Please consult dedicated ESP8266 forums/resources for hardware-related
  96. problems.