summaryrefslogtreecommitdiffstatshomepage
path: root/docs/esp8266
diff options
context:
space:
mode:
Diffstat (limited to 'docs/esp8266')
-rw-r--r--docs/esp8266/general.rst33
-rw-r--r--docs/esp8266/img/adafruit_products_pinoutstop.jpgbin0 -> 79455 bytes
-rw-r--r--docs/esp8266/quickref.rst51
-rw-r--r--docs/esp8266/tutorial/network_basics.rst2
-rw-r--r--docs/esp8266/tutorial/network_tcp.rst2
5 files changed, 59 insertions, 29 deletions
diff --git a/docs/esp8266/general.rst b/docs/esp8266/general.rst
index f996068d09..313e6074c1 100644
--- a/docs/esp8266/general.rst
+++ b/docs/esp8266/general.rst
@@ -6,8 +6,8 @@ ESP8266 is a popular WiFi-enabled System-on-Chip (SoC) by Espressif Systems.
Multitude of boards
-------------------
-There are multitude of modules and boards from different sources which carry
-ESP8266 chip. MicroPython tries to provide a generic port which would run on
+There are a multitude of modules and boards from different sources which carry
+the ESP8266 chip. MicroPython tries to provide a generic port which would run on
as many boards/modules as possible, but there may be limitations. Adafruit
Feather HUZZAH board is taken as a reference board for the port (for example,
testing is performed on it). If you have another board, please make sure you
@@ -18,13 +18,13 @@ To make a generic ESP8266 port and support as many boards as possible,
following design and implementation decision were made:
* GPIO pin numbering is based on ESP8266 chip numbering, not some "logical"
- numbering of a particular board. Please have manual/pin diagram of your board
- handy to find correspondce between your board pins and actual ESP8266 pins.
+ numbering of a particular board. Please have the manual/pin diagram of your board
+ at hand to find correspondence between your board pins and actual ESP8266 pins.
We also encourage users of various boards to share this mapping via MicroPython
forum, with the idea to collect community-maintained reference materials
eventually.
* All pins which make sense to support, are supported by MicroPython
- (for example, we don't expose pins which are used to connect SPI flash
+ (for example, pins which are used to connect SPI flash
are not exposed, as they're unlikely useful for anything else, and
operating on them will lead to board lock-up). However, any particular
board may expose only subset of pins. Consult your board reference manual.
@@ -37,10 +37,10 @@ Technical specifications and SoC datasheets
The datasheets and other reference material for ESP8266 chip are available
from the vendor site: http://bbs.espressif.com/viewtopic.php?f=67&t=225 .
-The are primary reference for the chip technical specifications, capabilities,
+They are the primary reference for the chip technical specifications, capabilities,
operating modes, internal functioning, etc.
-For your convinience, some of technical specifications are provided below:
+For your convenience, some of technical specifications are provided below:
* Architecture: Xtensa lx106
* CPU frequency: 80MHz overclockable to 160MHz
@@ -64,18 +64,18 @@ Boot process
On boot, MicroPython EPS8266 port executes ``_boot.py`` script from internal
frozen modules. It mounts filesystem in FlashROM, or if it's not available,
performs first-time setup of the module and creates the filesystem. This
-part of boot process is considered fixed, and not available for customization
+part of the boot process is considered fixed, and not available for customization
for end users (even if you build from source, please refrain from changes to
it; customization of early boot process is available only to advanced users
and developers, who can diagnose themselves any issues arising from
modifying the standard process).
-Once filesystem is mounted, ``boot.py`` is executed from it. The standard
+Once the filesystem is mounted, ``boot.py`` is executed from it. The standard
version of this file is created during first-time module set up and by
-defaults starts up a WebREPL daemon to handle incoming connections. This
+default starts up a WebREPL daemon to handle incoming connections. This
file is customizable by end users (for example, you may want to disable
WebREPL for extra security, or add other services which should be run on
-module start-up). But keep in mind that incorrect modifications to boot.py
+a module start-up). But keep in mind that incorrect modifications to boot.py
may still lead to boot loops or lock ups, requiring to reflash a module
from scratch.
@@ -89,5 +89,14 @@ the following in ``main.py``::
import my_app
my_app.main()
-This will allow to keep structure of your application clear, as well as
+This will allow to keep the structure of your application clear, as well as
allow to install multiple applications on a board, and switch among them.
+
+
+Real-time clock
+---------------
+
+Due to limitations of the ESP8266 chip the internal real-time clock (RTC)
+will overflow every 7:45h. If a long-term working RTC time is required then
+``time()`` or ``localtime()`` must be called at least once within 7 hours.
+MicroPython will then handle the overflow.
diff --git a/docs/esp8266/img/adafruit_products_pinoutstop.jpg b/docs/esp8266/img/adafruit_products_pinoutstop.jpg
new file mode 100644
index 0000000000..655e27aee3
--- /dev/null
+++ b/docs/esp8266/img/adafruit_products_pinoutstop.jpg
Binary files differ
diff --git a/docs/esp8266/quickref.rst b/docs/esp8266/quickref.rst
index bfded9bea1..779248369f 100644
--- a/docs/esp8266/quickref.rst
+++ b/docs/esp8266/quickref.rst
@@ -3,7 +3,7 @@
Quick reference for the ESP8266
===============================
-.. image:: https://learn.adafruit.com/system/assets/assets/000/028/689/medium640/adafruit_products_pinoutstop.jpg
+.. image:: img/adafruit_products_pinoutstop.jpg
:alt: Adafruit Feather HUZZAH board
:width: 640px
@@ -43,7 +43,7 @@ The ``network`` module::
wlan.scan() # scan for access points
wlan.isconnected() # check if the station is connected to an AP
wlan.connect('essid', 'password') # connect to an AP
- wlan.mac() # get the interface's MAC adddress
+ wlan.config('mac') # get the interface's MAC adddress
wlan.ifconfig() # get the interface's IP/netmask/gw/DNS addresses
ap = network.WLAN(network.AP_IF) # create access-point interface
@@ -199,9 +199,6 @@ The I2C driver is implemented in software and works on all pins::
buf = bytearray(10) # create a buffer with 10 bytes
i2c.writeto(0x3a, buf) # write the given buffer to the slave
- i2c.readfrom(0x3a, 4, stop=False) # don't send a stop bit after reading
- i2c.writeto(0x3a, buf, stop=False) # don't send a stop bit after writing
-
Deep-sleep mode
---------------
@@ -274,31 +271,55 @@ For low-level driving of a NeoPixel::
import esp
esp.neopixel_write(pin, grb_buf, is800khz)
+APA102 driver
+-------------
+
+Use the ``apa102`` module::
+
+ from machine import Pin
+ from apa102 import APA102
+
+ clock = Pin(14, Pin.OUT) # set GPIO14 to output to drive the clock
+ data = Pin(13, Pin.OUT) # set GPIO13 to output to drive the data
+ apa = APA102(clock, data, 8) # create APA102 driver on the clock and the data pin for 8 pixels
+ apa[0] = (255, 255, 255, 31) # set the first pixel to white with a maximum brightness of 31
+ apa.write() # write data to all pixels
+ r, g, b, brightness = apa[0] # get first pixel colour
+
+For low-level driving of an APA102::
+
+ import esp
+ esp.apa102_write(clock_pin, data_pin, rgbi_buf)
+
WebREPL (web browser interactive prompt)
----------------------------------------
WebREPL (REPL over WebSockets, accessible via a web browser) is an
experimental feature available in ESP8266 port. Download web client
-from https://github.com/micropython/webrepl , and start daemon using::
+from https://github.com/micropython/webrepl (hosted version available
+at http://micropython.org/webrepl), and start the daemon on a device
+using::
import webrepl
webrepl.start()
-(Release version will have it started on boot by default.)
+(Release versions have it started on boot by default.)
On a first connection, you will be prompted to set password for future
sessions to use.
The supported way to use WebREPL is by connecting to ESP8266 access point,
but the daemon is also started on STA interface if it is active, so if your
-routers is set up and works correctly, you may also use it while connecting
-to your normal Internet access point (use ESP8266 AP connection method if
-face any issues).
+router is set up and works correctly, you may also use WebREPL while connected
+to your normal Internet access point (use the ESP8266 AP connection method
+if you face any issues).
WebREPL is an experimental feature and a work in progress, and has known
-issues. There's also provision to transfer (both upload and download)
-files over WebREPL connection, but it has unstable status (be ready to
-reboot a module in case of issues). It still may be a practical way to
+issues.
+
+There's also provision to transfer (both upload and download)
+files over WebREPL connection, but it has even more experimental status
+than the WebREPL terminal mode. It is still a practical way to
get script files onto ESP8266, so give it a try using ``webrepl_cli.py``
-from the repository above. See forum for other community-supported
-alternatives to transfer files to ESP8266.
+from the repository above. See the MicroPython forum for other
+community-supported alternatives to transfer files to ESP8266.
diff --git a/docs/esp8266/tutorial/network_basics.rst b/docs/esp8266/tutorial/network_basics.rst
index 02a7054858..42aed56642 100644
--- a/docs/esp8266/tutorial/network_basics.rst
+++ b/docs/esp8266/tutorial/network_basics.rst
@@ -62,7 +62,7 @@ connect to your WiFi network::
print('connecting to network...')
sta_if.active(True)
sta_if.connect('<essid>', '<password>')
- while not network.isconnected():
+ while not sta_if.isconnected():
pass
print('network config:', sta_if.ifconfig())
diff --git a/docs/esp8266/tutorial/network_tcp.rst b/docs/esp8266/tutorial/network_tcp.rst
index 0a1cca4457..80a494721d 100644
--- a/docs/esp8266/tutorial/network_tcp.rst
+++ b/docs/esp8266/tutorial/network_tcp.rst
@@ -36,7 +36,7 @@ information they hold.
Using the IP address we can make a socket and connect to the server::
>>> s = socket.socket()
- >>> s.connect(addr[0][-1])
+ >>> s.connect(addr)
Now that we are connected we can download and display the data::