2015-06-10 22:29:56 +01:00
|
|
|
General information about the WiPy
|
|
|
|
==================================
|
|
|
|
|
2015-10-14 11:32:01 +01:00
|
|
|
No floating point support
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
Due to space reasons, there's no floating point support, and no math module. This
|
|
|
|
means that floating point numbers cannot be used anywhere in the code, and that
|
|
|
|
all divisions must be performed using '//' instead of '/'. Example::
|
|
|
|
|
|
|
|
r = 4 // 2 # this will work
|
|
|
|
r = 4 / 2 # this WON'T
|
|
|
|
|
|
|
|
Before applying power
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
The GPIO pins of the WiPy are NOT 5V tolerant, connecting them to voltages higer
|
|
|
|
than 3.6V will cause irreparable damage to the board. ADC pins, when configured
|
|
|
|
in analog mode cannot withstand volatges above 1.8V. Keep these considerations in
|
|
|
|
mind when wiring your electronics.
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-10 22:29:56 +01:00
|
|
|
WLAN default behaviour
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
When the WiPy boots with the default factory configuration starts in Access Point
|
2015-07-28 22:50:22 +01:00
|
|
|
mode with ``ssid`` that starts with: ``wipy-wlan`` and ``key: www.wipy.io``.
|
2015-06-10 22:29:56 +01:00
|
|
|
Connect to this network and the WiPy will be reachable at ``192.168.1.1``. In order
|
|
|
|
to gain access to the interactive prompt, open a telnet session to that IP address on
|
|
|
|
the default port (23). You will be asked for credentials:
|
2015-07-28 22:50:22 +01:00
|
|
|
``login: micro`` and ``password: python``
|
2015-06-10 22:29:56 +01:00
|
|
|
|
|
|
|
Local file system and SD card
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
There is a small internal file system (a drive) on the WiPy, called ``/flash``,
|
|
|
|
which is stored within the external serial flash memory. If a micro SD card
|
|
|
|
is hooked-up and enabled, it is available as ``/sd``.
|
|
|
|
|
2015-08-05 16:05:41 +01:00
|
|
|
When the WiPy boots up, it always boots from the ``boot.py`` located in the
|
2015-06-10 22:29:56 +01:00
|
|
|
``/flash`` file system. If during the boot process the SD card is enabled and
|
|
|
|
it's selected as the current drive then the WiPy will try to execute ``main.py``
|
|
|
|
that should be located in the SD card.
|
|
|
|
|
|
|
|
The file system is accessible via the native FTP server running in the WiPy.
|
|
|
|
Open your FTP client of choice and connect to:
|
|
|
|
|
2015-07-28 22:50:22 +01:00
|
|
|
``ftp://192.168.1.1``, ``user: micro``, ``password: python``
|
2015-06-10 22:29:56 +01:00
|
|
|
|
2015-10-14 11:32:01 +01:00
|
|
|
The FTP server on the WiPy doesn't support active mode, only passive, so for instance
|
|
|
|
if using the native unix ftp client, just after logging in::
|
|
|
|
|
|
|
|
ftp> passive
|
|
|
|
|
|
|
|
Besides that, the FTP server only supports onw data connection at a time. Check out
|
|
|
|
the Filezilla settings section below for more info.
|
|
|
|
|
2015-08-05 16:05:41 +01:00
|
|
|
FileZilla settings
|
|
|
|
------------------
|
|
|
|
Do not use the quick connect button, instead, open the site manager and create a new
|
|
|
|
configuration. In the ``General`` tab make sure that encryption is set to: ``Only use
|
|
|
|
plain FTP (insecure)``. In the Transfer Settings tab limit the max number of connections
|
|
|
|
to one, otherwise FileZilla will try to open a second command connection when retrieving
|
|
|
|
and saving files, and for simplicity and to reduce code size, only one command and one
|
|
|
|
data connections are possible. Other FTP clients might behave in a similar way.
|
|
|
|
|
|
|
|
Upgrading the firmware Over The Air
|
|
|
|
-----------------------------------
|
|
|
|
|
|
|
|
OTA software updates can be performed through the FTP server. Upload the ``mcuimg.bin`` file
|
|
|
|
to: ``/flash/sys/mcuimg.bin`` it will take around 6s. You won't see the file being stored
|
|
|
|
inside ``/flash/sys/`` because it's actually saved bypassing the user file system, but rest
|
|
|
|
assured that it was successfully transferred, and it has been signed with a MD5 checksum to
|
|
|
|
verify its integrity. Now, reset the MCU by pressing the switch on the board, or by typing::
|
|
|
|
|
2015-10-14 11:32:01 +01:00
|
|
|
import machine
|
|
|
|
machine.reset()
|
2015-08-05 16:05:41 +01:00
|
|
|
|
2015-06-10 22:29:56 +01:00
|
|
|
Boot modes
|
|
|
|
----------
|
|
|
|
|
|
|
|
If you power up normally, or press the reset button, the WiPy will boot
|
2015-07-14 20:39:07 +01:00
|
|
|
into standard mode; the ``boot.py`` file will be executed first, then
|
2015-06-10 22:29:56 +01:00
|
|
|
``main.py`` will run.
|
|
|
|
|
2015-07-28 22:03:53 +01:00
|
|
|
You can override this boot sequence by pulling ``GP28`` **up** (connect
|
2015-07-14 20:39:07 +01:00
|
|
|
it to the 3v3 output pin) during reset. This procedure also allows going
|
|
|
|
back in time to old firmware versions. The WiPy can hold up to 3 different
|
|
|
|
firmware versions, which are: the factory firmware plus 2 user updates.
|
|
|
|
|
2015-07-28 22:03:53 +01:00
|
|
|
After reset, if ``GP28`` is held high, the heart beat LED will start flashing
|
2015-07-14 20:39:07 +01:00
|
|
|
slowly, if after 3 seconds the pin is still being held high, the LED will start
|
|
|
|
blinking a bit faster and the WiPy will select the previous user update to boot.
|
2015-07-28 22:03:53 +01:00
|
|
|
If the previous user update is the desired firmware image, ``GP28`` must be
|
2015-07-14 20:39:07 +01:00
|
|
|
released before 3 more seconds elapse. If 3 seconds later the pin is still high,
|
|
|
|
the factory firmware will be selected, the LED will flash quickly for 1.5 seconds
|
|
|
|
and the WiPy will proceed to boot. The firmware selection mechanism is as follows:
|
|
|
|
|
|
|
|
|
2015-07-28 22:03:53 +01:00
|
|
|
**Safe Boot Pin** ``GP28`` **released during:**
|
2015-07-14 20:39:07 +01:00
|
|
|
|
|
|
|
+-------------------------+-------------------------+----------------------------+
|
|
|
|
| 1st 3 secs window | 2nd 3 secs window | Final 1.5 secs window |
|
|
|
|
+=========================+=========================+============================+
|
2015-08-05 16:05:41 +01:00
|
|
|
| | Safe boot, *latest* | | Safe boot, *previous* | | Safe boot, the *factory* |
|
2015-07-14 20:39:07 +01:00
|
|
|
| | firmware is selected | | user update selected | | firmware is selected |
|
|
|
|
+-------------------------+-------------------------+----------------------------+
|
|
|
|
|
2015-08-05 16:05:41 +01:00
|
|
|
In any if the above 3 scenarios, safe boot mode is entered, meaning that
|
|
|
|
the execution of both ``boot.py`` and ``main.py`` is skipped. This is
|
|
|
|
useful to recover from crash situations caused by the user scripts. The selection
|
|
|
|
made during safe boot is not persistent, meaning that after the next normal reset,
|
|
|
|
the latest firmware will run again.
|
2015-06-10 22:29:56 +01:00
|
|
|
|
|
|
|
The heart beat LED
|
|
|
|
------------------
|
|
|
|
|
2015-08-12 21:22:33 +01:00
|
|
|
By default the heart beat LED flashes once every 4s to signal that the system is
|
2015-10-19 14:19:34 +01:00
|
|
|
alive. This can be overridden through the :mod:`wipy` module::
|
2015-06-10 22:29:56 +01:00
|
|
|
|
2015-10-19 14:19:34 +01:00
|
|
|
import wipy
|
|
|
|
wipy.heartbeat(False)
|
2015-06-10 22:29:56 +01:00
|
|
|
|
|
|
|
There are currently 2 kinds of errors that you might see:
|
|
|
|
|
|
|
|
1. If the heart beat LED flashes quickly, then a Python script(eg ``main.py``)
|
|
|
|
has an error. Use the REPL to debug it.
|
|
|
|
2. If the heart beat LED stays on, then there was a hard fault, you cannot
|
2015-07-28 22:50:22 +01:00
|
|
|
recover from this, the only way out is to press the reset switch.
|
2015-06-10 22:29:56 +01:00
|
|
|
|