/wipy-environment

Startup script for wipy board

Primary LanguagePython

wipy environment

Overview

Some code for the WiPy board, facilitating setup network and running code from the SD card.

Features

Assuming the ExpansionBoard is present.

  • activate REPL on serial port
  • try to connect to home network (in STA mode), fall back to AP mode if that fails.
  • mount the SD card to /sd
  • add /sd/lib to sys.path and execute /sd/main.py on SD card
  • a tool to sync files from the PC with the WiPy (via FTP)

Note

The default fallback to AP mode is a security risk as the netowork name and passwort may be known (unless they were changed in the source code here)

Installation on WiPy

The wipy-ftp.py can be used to upload the files. For first time usage (assuming the WiPy is in AP mode with default settings, PC connected to this AP):

python3 wipy-ftp.py install
INFO:FTP:put /flash/boot.py
INFO:FTP:put /flash/main.py
INFO:FTP:put /flash/lib/expansionboard.py
INFO:FTP:put /flash/lib/autoconfig.py
Connect to an access point? [Y/n]: y
Enter SSID: <your SSID>
Enter passphrase: <your password>

Warning

wipy-ftp.py install Overwrites files without asking. Backup The files before running this tool when the WiPy was used before.

Once the WiPy connects to a router, its IP address must be updated in wipy-ftp.ini.

WiPy-FTP Tool

wipy-ftp.py is a tool to upload/download files via FTP.

Usage: wipy-ftp.py [-v --defaults] ACTION [ARGS]

-v, --verbose print more diagnostic messages
--defaults ignore .ini file and use defaults

ACTIONS are:

  • write-ini create wipy-ftp.ini with default settings
  • install copy boot.py, main.py and /lib from the PC to the WiPy
  • sync-lib copies only /lib
  • sync-top copies only boot.py, main.py
  • config-wlan ask for SSID/Password and write wlanconfig.py on WiPy
  • ls with optional path argument: list files
  • cat with filename: show text file contents
  • upgrade write mcuimg.bin file to WiPy for firmware upgrade
  • help this text

For configuration, a file called wipy-ftp.ini must be present with the following contents:

[FTP]
server = 192.168.1.1
user = micro
pass = python

The default file can be created by running wipy-ftp.py write-ini. These settings need to be changed, once the WiPy is connected to an access point.

Technical Details

The contents of device/flash goes to the WiPy internal flash memory. The contents of device/sd goes onto the SD card.

The WLAN configuration for STA mode are stored in flash/wlanconfig.py on the WiPy. This file is written by the config-wlan action. The security/WPA mode have to be changed in /lib/autoconfig.py, the default is WPA2.

References

WiPy Pins:

.               _______________
               | HB        RST |
SAFEBOOT  GP28 |               | GP3
          GP22 |               | GP4
S1        GP17 |               | GP0
LED       GP16 |               | GP3   VBATT
SD_DAT0   GP15 |               | GP31
          GP14 |               | GP30
          GP13 |               | GP6   FT_CTS
          GP12 |               | GP7   FT_RTS
SD_CMD    GP11 |               | GP8
          GP24 |               | GP9
          GP23 |               | GP10  SD_CLK
FT_TXD     GP1 |               | +3V3
FT_RXD     GP2 |               | GND
         RESET |               | Vin
                \    #####    /
                 \   #####   /
                  \  #####  /
                   ---------