MicroPython-Firmware schmirgeln (150er)

Einleitung

Ich schaue mir grade den aktuellen Stand von Terkin for MicroPython an und verwende dazu LinuxOnWindows (WSL).

Los gehts

@Andreas sollte das noch gehen oder hat sich der code da geändert?

Hier https://github.com/hiveeyes/hiveeyes-micropython-firmware/blob/master/doc/setup.rst gibt es nur die doku zum hochladen der Basis-Pakete mit make upload-requirements das geht, dauert aber recht lange

took 77.984 seconds

bei mir scheitert make recycle so

root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware# make recycle
.venv3/bin/rshell --port /dev/ttyS16 --buffer-size 2048 --timing --file tools/upload-requirements.rshell
Using buffer-size of 2048
Connecting to /dev/ttyS16 (buffer-size 2048)...
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /flash/
Setting time ... Apr 11, 2019 10:26:58
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 1970
Unable to create /flash/lib/terkin
took 0.559 seconds

das kommt bei make setup und funktioniert final nicht

root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware# make setup
.venv3/bin/pip --quiet install --requirement requirements-dev.txt
# Install "upip", the PyPI package manager for MicroPython.
.venv3/bin/pip install micropython-cpython-upip
Requirement already satisfied: micropython-cpython-upip in ./.venv3/lib/python3.5/site-packages (1.2.6)
Requirement already satisfied: micropython-cpython-usocket in ./.venv3/lib/python3.5/site-packages (from micropython-cpython-upip) (0.1)
Requirement already satisfied: micropython-cpython-uos in ./.venv3/lib/python3.5/site-packages (from micropython-cpython-upip) (0.1)
Requirement already satisfied: micropython-cpython-ujson in ./.venv3/lib/python3.5/site-packages (from micropython-cpython-upip) (0.2)
Requirement already satisfied: micropython-cpython-uerrno in ./.venv3/lib/python3.5/site-packages (from micropython-cpython-upip) (0.1)
Requirement already satisfied: micropython-cpython-uzlib in ./.venv3/lib/python3.5/site-packages (from micropython-cpython-upip) (0.1)
Requirement already satisfied: micropython-cpython-ussl in ./.venv3/lib/python3.5/site-packages (from micropython-cpython-upip) (0.1)
Requirement already satisfied: micropython-cpython-micropython in ./.venv3/lib/python3.5/site-packages (from micropython-cpython-usocket->micropython-cpython-upip) (0.2)
Requirement already satisfied: micropython-cpython-uio in ./.venv3/lib/python3.5/site-packages (from micropython-cpython-ussl->micropython-cpython-upip) (0.2)
# Install all required packages listed in file "requirements-mpy.txt".
.venv3/bin/python -m upip install -p ./dist-packages -r requirements-mpy.txt
Installing to: ./dist-packages/
Warning: pypi.org SSL certificate is not validated
Installing micropython-copy 3.3.3.post3 from https://files.pythonhosted.org/packages/da/0f/2474b2f9780c55869f3b0202ba91ed0e4679bb4a94f7ba9ff6c7a9f9851d/micropython-copy-3.3.3.post3.tar.gz
Installing micropython-types 3.3.3.post2 from https://files.pythonhosted.org/packages/62/e2/91eb43581c88e3119eef3a6d6789be26a5c5caa6e8b94d581736217be322/micropython-types-3.3.3.post2.tar.gz
Installing micropython-collections 0.1.3 from https://files.pythonhosted.org/packages/17/c8/2da83be4fe0cf730fcbf62ac584171d0ce0c4a0dd506b9a77930b0f4191c/micropython-collections-0.1.3.tar.gz
Installing micropython-collections.defaultdict 0.3 from https://files.pythonhosted.org/packages/b2/85/9e1a291d0404cda45814ef4385e6da2e7702d27b206fe69f39c980035563/micropython-collections.defaultdict-0.3.tar.gz
# Install "micropython-urllib.parse" without "micropython-re-pcre"
# to avoid collision with libraries shipped as Pycom builtins.
mkdir -p ./dist-packages/urllib
wget --quiet --no-clobber --directory-prefix ./dist-packages/urllib https://raw.githubusercontent.com/pfalcon/micropython-lib/5f619c88/urllib.parse/urllib/parse.py
touch ./dist-packages/urllib/__init__.py
# Install "micropython-base64" without 'micropython-binascii', 'micropython-re-pcre', 'micropython-struct'
wget --quiet --no-clobber --directory-prefix ./dist-packages https://raw.githubusercontent.com/pfalcon/micropython-lib/5f619c88/base64/base64.py
# Install "micropython-logging" without "micropython-os"
# to avoid collision with libraries shipped as Pycom builtins.
mkdir -p ./dist-packages/logging
wget --quiet --no-clobber --directory-prefix ./dist-packages/logging https://raw.githubusercontent.com/pfalcon/micropython-lib/5f619c88/logging/logging/__init__.py
wget --quiet --no-clobber --directory-prefix ./dist-packages/logging https://raw.githubusercontent.com/pfalcon/micropython-lib/5f619c88/logging/logging/handlers.py
# Install Pycom "mqtt.py"
wget --quiet --no-clobber --directory-prefix ./dist-packages https://raw.githubusercontent.com/pycom/pycom-libraries/6544105e/lib/mqtt/mqtt.py
# Install Pycoproc Libary
wget --quiet --no-clobber --directory-prefix ./dist-packages https://raw.githubusercontent.com/pycom/pycom-libraries/681302a4/lib/pycoproc/pycoproc.py
#Install quectel L76 GNSS library (Pytrack Board)
wget --quiet --no-clobber --directory-prefix ./dist-packages https://raw.githubusercontent.com/andrethemac/L76GLNSV4/b68b3402/L76GNSV4.py
#Install Pytrack Board Libary
wget --quiet --no-clobber --directory-prefix ./dist-packages https://raw.githubusercontent.com/pycom/pycom-libraries/ce0cfa5/pytrack/lib/LIS2HH12.py
#Install Pytrack Board Libary
wget --quiet --no-clobber --directory-prefix ./dist-packages https://raw.githubusercontent.com/pycom/pycom-libraries/0f123c7/pytrack/lib/pytrack.py
#Install BME280 Libary
wget --quiet --no-clobber --directory-prefix ./dist-packages https://raw.githubusercontent.com/catdog2/mpy_bme280_esp8266/d7e052b/bme280.py
# Install and patch "dotty_dict"
# https://github.com/pawelzny/dotty_dict
mkdir -p ./dist-packages/dotty_dict
wget --quiet --no-clobber --directory-prefix ./dist-packages/dotty_dict https://raw.githubusercontent.com/pawelzny/dotty_dict/c040a96/dotty_dict/__init__.py
wget --quiet --no-clobber --directory-prefix ./dist-packages/dotty_dict https://raw.githubusercontent.com/pawelzny/dotty_dict/c040a96/dotty_dict/dotty_dict.py
patch --forward dist-packages/dotty_dict/dotty_dict.py tools/dotty_dict-01.patch || true
patching file dist-packages/dotty_dict/dotty_dict.py
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file dist-packages/dotty_dict/dotty_dict.py.rej
# Install OneWire and DS18x20 libraries
# https://github.com/micropython/micropython/tree/master/drivers
mkdir -p ./dist-packages/onewire
touch ./dist-packages/onewire/__init__.py
wget --quiet --no-clobber --directory-prefix ./dist-packages/onewire https://raw.githubusercontent.com/pycom/pycom-libraries/aacafd62/examples/DS18X20/onewire.py
# Install PyCayenneLPP from Git repository.
rm -rf ./.pycayennelpp.tmp
mkdir -p ./.pycayennelpp.tmp
git clone https://github.com/hiveeyes/pycayennelpp ./.pycayennelpp.tmp
Cloning into './.pycayennelpp.tmp'...
remote: Enumerating objects: 222, done.
remote: Total 222 (delta 0), reused 0 (delta 0), pack-reused 222
Receiving objects: 100% (222/222), 44.73 KiB | 0 bytes/s, done.
Resolving deltas: 100% (135/135), done.
Checking connectivity... done.
rm -r ./.pycayennelpp.tmp/cayennelpp/tests
cp -r ./.pycayennelpp.tmp/cayennelpp ./dist-packages/
rm -rf ./.pycayennelpp.tmp
.venv3/bin/rshell --port  --buffer-size 2048 --timing mkdir /flash/dist-packages
usage: rshell [options] [command]
rshell: error: argument -p/--port: expected one argument
Makefile:78: recipe for target 'upload-requirements' failed
make: *** [upload-requirements] Error 2
root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware#

Was wir gestern schon aufgedeckt haben: Mit dem FiPy funktioniert make list-boards, mit dem WiPy nicht.

Hi Clemens,

wir sollten hier noch etwas dran schleifen.

image

Alles richtig!

Sollten wir vereinfachen zu “make setup”.

Ja, das wäre natürlich auch toll, das verbessern zu können. @einsiedlerkrebs, @tonke und ich haben schon ein paar Ideen dazu. Manuell kann man darauf inzwischen durch gezielte Deaktivierung entsprechender Zeilen in den tools/*.rshell Dateien einwirken.

Schau ich mir an!

Allerdings:
Wenn der Ordner jedoch bereits existiert, kommt glaube ich eine ähnliche Fehlermeldung, die man aber getrost ignorieren kann. Fragen: a) Was passiert denn danach? b) Kannst Du mir die Ausgabe von git diff am Telefon vorlesen, damit wir uns der Sache nähern können? Danke!

bei port fehlt eine Portangabe, äquivalent zum Beispiel darüber (make recycle).
Wo auch immer die gesetzt wird, oder wie auch immer die bei Windows “gewonnen” wird…

1 Like

Problem

Korrekt, in dem Fall ist die Meldung eindeutig:

rshell: error: argument -p/--port: expected one argument

Danke!

Ursache

MCU_SERIAL_PORT ist nicht gesetzt, siehe configure serial port for Hiveeyes MicroPython Datalogger. An einigen Stellen wird das bereits rechtzeitig abgefangen, aber scheinbar noch nicht überall, deshalb brauchen wir mehr Tester und mehr Programmierer.

Fazit

Vielen Dank für die Meldung und Analyse, beim nächsten Release versuche ich einige Stolperfallen für Anfänger zu verbessern, speziell in Richtung Setup commandline-based MicroPython development environment on Linux, macOS and Windows sowie Settings.py der Hiveeyes Micropython-Firmware. Sorry dawei, @clemens!

2 posts were split to a new topic: Improving the usability for the MicroPython sandbox

Für mich würde die Info hier z.B. nicht reichen. Setup installiert für mich als DAU irgendwas lokal. Abhängigkeiten können auch von irgendwelchen neu installierten Paketen kommen. Für mich könnte das genauso gut irgendwas mit der “developer sandbox” zu tun haben, dass dafür der FiPy angeschlossen sein muss und der Port definiert sein muss, erschließt sich mir hier nicht, steht auch nicht in der Doku!

Sorry, wenn ich hier nerve, aber wenn wir das nicht halbwegs nachvollziehbar hinbekommen wird da keiner Testen, wenn ich hier nicht mit im Team wäre hätte ich auch schon längst aufgegeben und gesagt, ok, Sch… MicroPython, nehme ich halt die Arduino IDE. Bitte nicht falsch verstehen, ich halte das aber fürs Projekt essentiell!

2 posts were merged into an existing topic: Improving the usability for the MicroPython sandbox

Problem

I’m getting a core dump on 1.18.2.r4 (v1.8.6). It happens only on cold start (machine.reset()) triggered by make recycle. After pulling the plug using warm start (CTRL+D), the Firmware boots and runs flawlessly (see success below).

Details

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff8028,len:8
load:0x3fff8030,len:1688
load:0x4009fa00,len:0
load:0x4009fa00,len:14592
entry 0x400a059c
[boot.py] INFO: Python module search path is: [\'\', \'/flash\', \'/flash/lib\', \'dist-packages\']

Guru Meditation Error: Core  0 panic\'ed (InstrFetchProhibited)
. Exception was unhandled.
Register dump:
PC      : 0x00000000  PS      : 0x00060c30  A0      : 0x8011af2d  A1      : 0x3ffbd650  
A2      : 0x00000000  A3      : 0x00000037  A4      : 0xffffffa2  A5      : 0x3fbc1e24  
A6      : 0x00000008  A7      : 0x00000000  A8      : 0x80126208  A9      : 0x3ffbd640  
A10     : 0x3fbc1e40  A11     : 0x00000037  A12     : 0xffffffa2  A13     : 0x3ffbd6e4  
A14     : 0x7777b137  A15     : 0x7777b137  SAR     : 0x00000010  EXCCAUSE: 0x00000014  
EXCVADDR: 0x00000000  LBEG    : 0x4009b625  LEND    : 0x4009b659  LCOUNT  : 0xffffffff  

Backtrace: 0x00000000:0x3ffbd650 0x4011af2a:0x3ffbd670 0x4011bf37:0x3ffbd740 0x401324d5:0x3ffbd760 0x40134037:0x3ffbd7b0

================= CORE DUMP START =================
/EIAABEAAABsAQAA
WNj7P5DV+z9Q2Ps/
UNb7P/DX+z92S9j9DFP8PwxT/D9Y2Ps/BFP8PwIAAADoUPw/6FD8P1jY+z8AAAAA=
================= CORE DUMP END =================
Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff8028,len:8
load:0x3fff8030,len:1688
load:0x4009fa00,len:0
load:0x4009fa00,len:14592
entry 0x400a059c
[boot.py] INFO: Python module search path is: [\'\', \'/flash\', \'/flash/lib\', \'dist-packages\']

3.1999 [terkin.configuration     ] INFO   : Configuration settings:
3.2139 [terkin.configuration     ] INFO   : Section "telemetry": {"targets": [{"address": {"node": "node-01-mqtt-json", "gateway": "area-42", "realm": "workbench", "network": "testdrive"}, "enabled": true, "endpoint": "mqtt://daq.example.org"}, {"address": {"node": "node-01-http-json", "gateway": "area-42", "realm": "workbench", "network": "testdrive"}, "enabled": false, "endpoint": "https://daq.example.org/api"}, {"endpoint": "mqtt://daq.example.org", "encode": "base64", "enabled": false, "address": {"node": "node-01-mqtt-lpp", "gateway": "area-42", "realm": "workbench", "network": "testdrive"}, "format": "lpp"}]}
3.2708 [terkin.configuration     ] INFO   : Section "sensors": {"registry": {"pytrack": {"bus": "i2c:1"}, "waterlevel": {"pin_adc_in": "P18"}, "bme280_1": {"bus": "i2c:1"}, "moisture": {"scaling": 4.096, "pin_adc_in": "P15"}, "ds18x20": {"bus": "onewire:0"}, "hx711": {"offset": 130800.0, "scale": 11.02667, "pin_pdsck": "P21", "pin_dout": "P22"}, "bme280": {"bus": "i2c:0"}}, "busses": [{"pin_scl": "P10", "number": 0, "enabled": true, "family": "i2c", "pin_sda": "P9"}, {"pin_scl": "P21", "number": 1, "enabled": false, "family": "i2c", "pin_sda": "P22"}, {"enabled": true, "pin_data": "P11", "number": 0, "family": "onewire"}]}
3.3276 [terkin.configuration     ] INFO   : Section "main": {"interval": 1.0}
3.3405 [terkin.configuration     ] INFO   : Section "networking": {"wifi": {"stations": [{"ssid": "Frau Doktor", "password": "REDACTED"}], "timeout": 15000}, "lora": {"otaa": {"application_key": "<REGISTRATION NEEDED>", "frequency": 868100000, "region": "LoRa.EU868", "datarate": 0, "device_eui": "<GENERATED_FROM_LORA_MAC>", "application_eui": "<REGISTRATION NEEDED>"}, "antenna_attached": false}}
3.3758 [terkin.datalogger        ] INFO   : Starting BOB MicroPython Datalogger 0.2.1

---------------------------------------------
System memory info (in bytes)
---------------------------------------------
MPTask stack water mark: 6740
ServersTask stack water mark: 976
LoRaTask stack water mark: 1900
SigfoxTask stack water mark: 2928
TimerTask stack water mark: 2172
IdleTask stack water mark: 584
System free heap: 358028
---------------------------------------------

3.4218 [terkin.device            ] INFO   : 
================================
BOB MicroPython Datalogger 0.2.1
================================
CPU freq     160.0 MHz
Device id    807d3ac337b0


Python  : 3.4.0


3.4389 [terkin.device            ] INFO   : Starting networking
4.6001 [terkin.radio             ] INFO   : WiFi STA: Starting connection
4.6099 [terkin.radio             ] INFO   : WiFi STA: Scanning for networks
7.1356 [terkin.radio             ] INFO   : WiFi STA: Available networks: frozenset({\'EasyBox-678090\', \'RUM_nomap\', \'FRITZLE\', \'Fritzle\', \'Gue-Fritz\', \'Frau Doktor Gastzugang\', \'WLAN-KWCZNK\', \'Frau Doktor\', \'o2-WLAN87\', \'Perlaky_HOME\', \'FRITZ!Box 7490\', \'030\', \'o2-WLAN24\'})
7.1591 [terkin.radio             ] INFO   : WiFi STA: Attempting to connect to network "Frau Doktor"
7.1700 [terkin.radio             ] INFO   : WiFi STA: Connecting to "Frau Doktor"
7.1885 [terkin.radio             ] INFO   : WiFi STA: Waiting for network "Frau Doktor".
8.2005 [terkin.radio             ] INFO   : WiFi STA: Waiting for network "Frau Doktor".
9.2112 [terkin.radio             ] INFO   : WiFi STA: Waiting for network "Frau Doktor".
10.2223 [terkin.radio             ] INFO   : WiFi STA: Waiting for network "Frau Doktor".
11.2412 [terkin.radio             ] INFO   : WiFi STA: Connected to "Frau Doktor" with IP address "192.168.178.58"
11.2586 [terkin.radio             ] INFO   : WiFi STA: Networking address: mac=b\'\\x80}:\\xc37\\xb0\', ifconfig=(\'192.168.178.58\', \'255.255.255.0\', \'192.168.178.1\', \'192.168.178.1\')
11.2729 [terkin.radio             ] INFO   : Networking established
11.2863 [terkin.device            ] INFO   : [LoRa] Disabling LoRa interface as no antenna has been attached. ATTENTION: Running LoRa without antenna will wreck your device.
11.2979 [terkin.device            ] INFO   : Starting telemetry
17.9774 [terkin.telemetry         ] INFO   : Telemetry channel URI: mqtt://daq.example.org/workbench/testdrive/area-42/node-01-mqtt-json
17.9871 [terkin.telemetry         ] INFO   : Starting Terkin TelemetryClient
18.0102 [terkin.datalogger        ] INFO   : Starting all busses [{\'pin_scl\': \'P10\', \'number\': 0, \'enabled\': True, \'family\': \'i2c\', \'pin_sda\': \'P9\'}, {\'pin_scl\': \'P21\', \'number\': 1, \'enabled\': False, \'family\': \'i2c\', \'pin_sda\': \'P22\'}, {\'enabled\': True, \'pin_data\': \'P11\', \'number\': 0, \'family\': \'onewire\'}]
18.0716 [terkin.sensor            ] INFO   : Found 0 I2C devices: [].
18.0821 [terkin.sensor            ] INFO   : Registering bus "i2c:0"
19.8042 [terkin.sensor            ] INFO   : Found 0 OneWire (DS18x20) devices: [].
19.8158 [terkin.sensor            ] INFO   : Registering bus "onewire:0"
19.8248 [terkin.datalogger        ] INFO   : Registering Terkin sensors
19.8337 [hiveeyes.datalogger      ] INFO   : Registering Hiveeyes sensors
20.4968 [hiveeyes.sensor_hx711    ] INFO   : Selected HX711 hardware driver "heisenberg"
20.5068 [hx711                    ] INFO   : HX711 initialization started
20.5175 [hx711                    ] INFO   : HX711 initialization succeeded
20.5288 [hx711_heisenberg         ] INFO   : Gain & initial value set
20.5449 [terkin.sensor            ] INFO   : Trying to find bus by name "onewire:0"
20.5544 [terkin.sensor            ] INFO   : Found bus by name "onewire:0": <OneWireBus object at 3f9865d0>
20.5731 [terkin.sensor            ] INFO   : Trying to find bus by name "i2c:0"
20.5828 [terkin.sensor            ] INFO   : Found bus by name "i2c:0": <I2CBus object at 3f9860d0>
20.5996 [hiveeyes.sensor_bme280   ] ERROR  : BME280 hardware driver failed
Traceback (most recent call last):
File "/flash/lib/hiveeyes/sensor_bme280.py", line 38, in start
File "dist-packages/bme280.py", line 74, in __init__
OSError: I2C bus error

20.6202 [terkin.datalogger        ] INFO   : --- loop ---
20.6293 [terkin.datalogger        ] INFO   : Terkin loop
20.7326 [terkin.telemetry         ] INFO   : Telemetry transport: MQTT over TCP over WiFi
21.3049 [terkin.telemetry         ] INFO   : Connecting to MQTT broker
'
Traceback (most recent call last):
1 Like

Also, connecting to REPL fails regularly with

root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware# make repl
.venv3/bin/rshell --port /dev/ttyS16 --buffer-size 2048 --timing repl
Using buffer-size of 2048
Connecting to /dev/ttyS16 (buffer-size 2048)...
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /flash/
Setting time ... Traceback (most recent call last):
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.5/site-packages/rshell/main.py", line 1249, in connect
    ip_address = socket.gethostbyname(port)
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".venv3/bin/rshell", line 10, in <module>
    sys.exit(main())
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.5/site-packages/rshell/command_line.py", line 4, in main
    rshell.main.main()
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.5/site-packages/rshell/main.py", line 2821, in main
    real_main()
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.5/site-packages/rshell/main.py", line 2783, in real_main
    connect(args.port, baud=args.baud, wait=args.wait, user=args.user, password=args.password)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.5/site-packages/rshell/main.py", line 1255, in connect
    connect_serial(port, baud=baud, wait=wait)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.5/site-packages/rshell/main.py", line 1279, in connect_serial
    dev = DeviceSerial(port, baud, wait)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.5/site-packages/rshell/main.py", line 1543, in __init__
    Device.__init__(self, pyb)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.5/site-packages/rshell/main.py", line 1341, in __init__
    now = self.sync_time()
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.5/site-packages/rshell/main.py", line 1473, in sync_time
    now.tm_hour, now.tm_min, now.tm_sec, 0))
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.5/site-packages/rshell/main.py", line 1433, in remote
    output = self.pyb.exec_raw_no_follow(func_src)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.5/site-packages/rshell/pyboard.py", line 240, in exec_raw_no_follow
    raise PyboardError('could not exec command')
rshell.pyboard.PyboardError: could not exec command
Makefile:103: recipe for target 'repl' failed
make: *** [repl] Error 1
1 Like

But sometimes make repl is working:

root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware# make repl
.venv3/bin/rshell --port /dev/ttyS16 --buffer-size 2048 --timing repl
Using buffer-size of 2048
Connecting to /dev/ttyS16 (buffer-size 2048)...
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /flash/
Setting time ... Apr 11, 2019 20:59:39
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 1970
Entering REPL. Use Control-X to exit.
>
Pycom MicroPython 1.18.2.r4 [v1.8.6-849-ba178ae] on 2019-04-01; FiPy with ESP32
Type "help()" for more information.
1 Like

When trying to connect to mqtt://daq.example.org/, I am getting this:

   85.9717 [terkin.datalogger        ] INFO   : Telemetry transmission: FAILURE
   87.0769 [terkin.datalogger        ] INFO   : --- loop ---
   87.0864 [terkin.datalogger        ] INFO   : Terkin loop
   87.1933 [terkin.telemetry         ] INFO   : Connecting to MQTT broker
   93.8700 [terkin.telemetry         ] ERROR  : Telemetry failed for adapter mqtt://daq.example.org/{'realm': 'workbench', 'gateway': 'area-42', 'network': 'testdrive', 'base_uri': 'mqtt://daq.example.org', 'node': 'node-01-mqtt-json'}
Traceback (most recent call last):
  File "/flash/lib/terkin/telemetry.py", line 43, in transmit
  File "/flash/lib/terkin/telemetry.py", line 89, in transmit
  File "/flash/lib/terkin/telemetry.py", line 205, in transmit
  File "/flash/lib/terkin/telemetry.py", line 365, in send
  File "/flash/lib/terkin/telemetry.py", line 432, in publish
  File "/flash/lib/terkin/telemetry.py", line 411, in ensure_connection
  File "/flash/lib/terkin/telemetry.py", line 425, in connect
  File "/flash/lib/terkin/telemetry.py", line 424, in connect
  File "dist-packages/logging/__init__.py", line 72, in exception
  File "dist-packages/logging/__init__.py", line 69, in exc
  File "/flash/lib/terkin/logging.py", line 31, in log
  File "dist-packages/logging/__init__.py", line 132, in emit
  File "dist-packages/logging/__init__.py", line 184, in format
TypeError: not enough arguments for format string
1 Like

settings.py snippet for Hiveeyes telemetry:

        # JSON over MQTT
        {
            # Enable/disable this telemetry target.
            'enabled': True,

            # Define telemetry endpoint and address information.
            'endpoint': 'mqtt://swarm.hiveeyes.org',
            'address': {
                "realm": "hiveeyes",
                "network": "testdrive",
                "gateway": "area-007",
                "node": "fipy-cgu-01",
            },
        },

Success

$ mosquitto_sub -h swarm.hiveeyes.org -p 1883 -t 'hiveeyes/testdrive/#' -v
hiveeyes/testdrive/area-005/fipy-cg-01/data.json {"memfree": 2432320, "weight": 0.0}

See also: Dashboard hiveeyes-testdrive-area-005-fipy-cg-01.

Thanks

@clemens: Thanks for your patience and good luck for connecting the sensor hardware.

1 Like

… und was ist mit dem hier?

Alles was hier steht ist relevant für Verbesserungen auf dem Weg zum 0.3.0 Release. Der Stand vom master lief zuletzt auf den Gerätschaften @tonke mit ziemlich viel Hardware dran, während @clemens gerade auf einem nackten FiPy unterwegs war.

Die Robustheit zeigt sich bereits jetzt, dass die Firmware in diesem Fall nicht zwingend abstürzt. Das war ein wesentliches Ziel meinerseits. So können wir zukünftig auch Hardwarefehler über die Telemetrie fernmelden.

Es ist jedoch durchaus möglich, dass just dieser falsche Buszugriff im Kontext von “direkt nach dem Kaltstart” doch zum core dump führt – “Unhandled Exception” deutet irgendwie darauf hin. Schau ich mir an!

Bottom line

This works, sometimes even on LinuxOnWindows. However, it’s still flakey and has rough edges, especially on the documentation side.

# Find serial port
make list-serials

# Configure serial port
export MCU_SERIAL_PORT=/dev/ttyS16

# Pre-flight checks
make list-boards

# Bootstrap dependencies once.
# Usage: After updating the list of dependencies, e.g. through "git pull".
make setup

# Upload user-space firmware and trigger a cold start.
# Usage: Each time you modify code.
make recycle

Instead of the serial port, you might want to run this over the network by configuring the IP address like

export MCU_SERIAL_PORT=192.168.178.42

However, this obviously only works when the device has joined your local WiFi successfully.

nun, ich weiß ja garnicht , ob da tatsächlich ein BME280 dran ist (und wenn, ob auch an den definierten pins), insofern kann ich nicht einschätzen, ob das “nur” ein bus timeout war, weil an der gewünschen I²C-Adresse kein Gerät nach $zeit geantwortett hat, welches der Proz da erwartet hat.

Man könnte sowas zu Laufzeit quasi enumerieren, indem man á la i2cscan nicht alle, aber alle irgendwo definierten I²C-Adressen anfragt und, da die Fehler “vom System” abgefangen werden™, weitere Abfragen irgendwelcher I²C-Sensoren vom Ergebnis dieses ersten scans abhängig macht… aber muß man auch nicht, ist eher bei 1wire üblich. Zukunftsmusik.

1 Like

Fragen

Datenübertragung belauschen

Wenn ich die REPL-Ausgabe richtig interpretiere werden nur die Daten des BME übertragen. Wo kann ich sehen, was tatsächlich übertragen wird?

Sensoren zuschalten

Warum werden die DS18B20- und Waage-Daten nicht übertragen? Angeschlossen sind 5 DS18B20 und eine Wägezelle.

Überflüssige Konfigurationsschnipsel entfernen

Muss ich die Sachen ab 'bme280_1': löschen oder können die da stehen bleiben?

Probleme

"make recycle" freezes

Weiter habe ich immer noch Probleme mit make recycle, manchmal funktionierts, manchmal bleibt es ganz am Anfang hängen. Wenn es durchläuft kommt manchmal die Ausgabe eines core dump …


settings.py

Das ist meine aktuelle Konfiguration.

"""Datalogger configuration"""

# General settings.
main = {
    # Measurement interval.
    'interval': 1.0,
}

# Networking configuration.
networking = {
    'wifi': {
        # WiFi stations to connect to in STA mode.
        'stations': [

            # Variant 1: Using DHCP.
            {'ssid': 'xxxx', 'password': 'yyy'},

            # Variant 2: Using static IP address.
            #{
            #    'ssid': 'FooBar',
            #    'password': 'SECRET',
            #    # Use static network configuration (ip, subnet_mask, gateway, DNS_server).
            #    'ifconfig': ('192.168.42.42', '255.255.255.0', '192.168.42.1', '192.168.42.1'),
            #},
        ],

        # The maximum time in milliseconds to wait for the connection to succeed.
        'timeout': 15000,
    },
    'lora': {
        'otaa': {
            'frequency': 868100000,
            'region': 'LoRa.EU868',
            'datarate': 0,
            'device_eui': '<GENERATED_FROM_LORA_MAC>',
            'application_eui': '<REGISTRATION NEEDED>',
            'application_key': '<REGISTRATION NEEDED>',
        },
        'antenna_attached': False,
    }
}

# Telemetry configuration.
telemetry = {
    'targets': [

        # JSON over MQTT
        {
            # Enable/disable this telemetry target.
            'enabled': True,

            # Define telemetry endpoint and address information.
            'endpoint': 'mqtt://swarm.hiveeyes.org',
            'address': {
                "realm": "hiveeyes",
                "network": "testdrive",
                "gateway": "area-005",
                "node": "fipy-cg-01",
            },
        },

        # JSON over HTTP
        {
            # Enable/disable this telemetry target.
            'enabled': False,

            # Define telemetry endpoint and address information.
            'endpoint': 'https://daq.example.org/api',
            'address': {
                "realm": "workbench",
                "network": "testdrive",
                "gateway": "area-42",
                "node": "node-01-http-json",
            },

            # Use alternative, non-HTTPS endpoint.
            # 'endpoint': 'http://daq.example.org/api-notls',

        },

        # CayenneLPP over MQTT, Base64 encoded
        {
            # Enable/disable this telemetry target.
            'enabled': False,

            # Define telemetry endpoint and address information.
            'endpoint': 'mqtt://daq.example.org',
            'address': {
                "realm": "workbench",
                "network": "testdrive",
                "gateway": "area-42",
                "node": "node-01-mqtt-lpp",
            },
            'format': 'lpp',
            'encode': 'base64',
        }
    ],
}

# Sensor configuration.
sensors = {
    'registry': {
        'hx711': {
            'pin_dout': 'P22',
            'pin_pdsck': 'P21',
            'scale': 11.026667,
            'offset': 130800.0,
        },
        'ds18x20': {
            'bus': 'onewire:0',
        },
        'bme280': {
            'bus': 'i2c:0',
            # TODO: make sensor be initialized with address
            # 'address': 0x77,
        },
        'bme280_1': {
            'bus': 'i2c:1',
        },
        'pytrack': {
            'bus': 'i2c:1',
        },
        'moisture': {
            'pin_adc_in': 'P15',
            'scaling': 4.096,
        },
        'waterlevel': {
            'pin_adc_in': 'P18'
        },
    },
    'busses': [
        {
            "family": "i2c",
            "number": 0,
            "enabled": True,
            "pin_sda": "P9",
            "pin_scl": "P10",
        },
        {
            "family": "i2c",
            "number": 1,
            "enabled": False,
            "pin_sda": "P22",
            "pin_scl": "P21",
        },
        {
            "family": "onewire",
            "number": 0,
            "enabled": True,
            "pin_data": "P11",
        },
    ]
}
1 Like