Running the Terkin-Datalogger on STM32

Install Annapurna Firmware

Due to memory constraints on the Pyboard-D SF2, we will freeze all modules from the dist-packages folder into a custom firmware. [1]

annapurna-stm32-pybd-sf2-20190922.dfu (953.7 KB)

# Acquire firmware file.
wget https://community.hiveeyes.org/uploads/short-url/dRngJuQiwYjeS0oMZgUCI7oDWPy.dfu

# Identify serial number.
dfu-util --list

# Install firmware on device.
dfu-util --serial="355931523037" --download annapurna-stm32-pybd-sf2-20190922.dfu

  1. If you want to build the firmware yourself, you are welcome to follow Building Vanilla MicroPython for PYBD_SF2. ↩︎

Install Terkin Datalogger

git clone https://github.com/hiveeyes/hiveeyes-micropython-firmware
make setup
make list-serials
export MCU_PORT=/dev/cu.usbmodem1412 # pyboard
make pyboard-recycle MPY_CROSS=true MPY_TARGET=bytecode MPY_VERSION=1.11

Detach

Press CTRL+].

Attach

make console

Demo

boot-to-network.log
[boot.py] INFO: Python module search path is: ['', '/flash', '/flash/lib']
[boot.py] INFO: Starting "umal" bootloader
[umal]     INFO: Python module search path is: ['/flash/lib-mpy-1.11-bytecode', '', '/flash', '/flash/lib', '/flash/dist-packages', '/flash/terkin', '/flash/hiveeyes']
[main.py] INFO: Loading settings
[main.py] INFO: Starting logging
[main.py] INFO: Starting Terkin Datalogger
[main.py] INFO: Loading modules
    1.0500 [terkin.configuration     ] INFO   : Starting TerkinConfiguration on path "/flash"
    1.0620 [terkin.configuration     ] INFO   : Ensuring existence of backup directory at "/flash/backup"
    1.1680 [terkin.device            ] WARNING: Could not determine reset cause
    1.1800 [terkin.watchdog          ] INFO   : Skipping watchdog timer (WDT)
    1.1930 [terkin.device            ] INFO   : Start curating the garbage collector
    1.2240 [terkin.device            ] INFO   : Curating the garbage collector finished. Free memory: 71168
    1.2410 [terkin.device            ] INFO   : Turning off LTE modem
    1.2640 [terkin.device            ] ERROR  : Shutting down LTE modem failed
    1.2770 [terkin.device            ] WARNING: FIXME: Skip touching Bluetooth on vanilla MicroPython platforms
    1.2890 [terkin.watchdog          ] INFO   : Resuming watchdog
    1.3030 [terkin.datalogger        ] INFO   : Starting Hiveeyes MicroPython Datalogger 0.6.0
    1.3380 [terkin.device            ] INFO   :

=====================================
Hiveeyes MicroPython Datalogger 0.6.0
=====================================
CPU freq     120.0 MHz
Device id    210026001151373031313335


Python  : 3.4.0
machine : PYBD-SF2W with STM32F722IEK
nodename: pyboard
release : 1.11.0
sysname : pyboard
version : v1.11-328-gd96391aca on 2019-09-21

    1.3510 [terkin.device            ] INFO   : Starting networking
    1.3670 [terkin.network.wifi      ] INFO   : Starting stopwatch
    1.4000 [terkin.network.wifi      ] INFO   : Started stopwatch successfully
    1.4130 [terkin.network.wifi      ] INFO   : WiFi STA: Will exclusively use STA mode on this platform
    1.4260 [terkin.network.wifi      ] INFO   : WiFi STA: Networking address (MAC): {}
    1.4390 [terkin.network.wifi      ] INFO   : WiFi STA: Networking address (IP):  ('0.0.0.0', '255.255.255.0', '192.168.0.1', '8.8.8.8')
    1.4520 [terkin.network.wifi      ] INFO   : WiFi: Starting interface
    2.0960 [terkin.network.wifi      ] INFO   : WiFi STA: Preparing connection to network "GartenNetzwerk"
    2.1130 [terkin.network.wifi      ] INFO   : WiFi STA: Starting connection to "GartenNetzwerk"
    2.1560 [terkin.network.wifi      ] INFO   : WiFi STA: Waiting for network to come up within 14.999 seconds
    5.0380 [terkin.network.wifi      ] INFO   : WiFi STA: Connected to "GartenNetzwerk" with IP address "192.168.178.39"
    5.0550 [terkin.network.wifi      ] INFO   : WiFi STA: Networking address (MAC): {}
    5.0700 [terkin.network.wifi      ] INFO   : WiFi STA: Networking address (IP):  ('192.168.178.39', '255.255.255.0', '192.168.178.1', '192.168.178.1')
    5.1090 [terkin.network.core      ] INFO   : Waiting for network stack to come up for 5 seconds
    5.1510 [terkin.network.core      ] INFO   : Network stack ready