Portierung des Terkin-Datenlogger auf Genuine MicroPython für ESP32

Hallo Markus,

zu Deiner Frage nach einer optimaleren Gestaltung der Plattformweiche habe ich Dir folgendes vorbereitet:

else:
    raise NotImplementedError('Reading the ADC for vbatt is '
                              'not implemented on this platform')

a) Verwenden wir so Vanilla MicroPython als “first-citizen” und b) besteht so nicht die Gefahr, dass die Routine ins Leere läuft. Gleichzeitig wird der Anwender optimal informiert.

Ich hoffe das hilft Dir für die folgenden Arbeiten weiter.

Viele Grüße,
Andreas.

1 Like

Wir sollten den onewire.py aus dist-packages umbenennen. Der aus uPy heißt genauso.

1 Like

Erledigt. Der native heißt nun onewire_native.py und der bisherige onewire_python.py. Die entsprechende Ansteuerung berücksichtigt dies nun auch (untested!).

Dabei kommt a) die Plattformweiche zum Einsatz, um die Modulimporte handzuhaben und b) der neue DS18X20NativeDriverAdapter, um die Ansteuerung der Treiber-API zur Laufzeit auszugleichen.

This came in at almost the same time. Unfortunately, I have not been quicker to push the improvements with Improve multi-platform support for 1-Wire and DS18X20 driver · hiveeyes/terkin-datalogger@7330d65 · GitHub.

Within the comment on your PR you mentioned

The DS18X20 needs some further care.

Can you see if this further care now might have been done already?

Ich werde den PR dann nochmal nachziehen…

Ich versteh gerade nur Dein Umbennungsschema nicht. Der von uPy heißt ‘onewire’ - den können wir schlecht umbenennen, der ist integriert. Den bisherigen könnten wir vielleicht ‘onewire_pycom’ nennen - dann ist klar, für was der gut ist.
Der DS18X20NativeDriverAdapter vereinheitlicht dann die Schnittstelle, korrekt?

1 Like

Ok, wenn der schon automatisch integriert ist, sieht die Sache anders aus. Das war mir nicht klar. Ich werde es verbessern. Das heißt, auch die Datei ds18x20.py ist bereits als eingefrorenes Modul automatisch ohne weiteres in der Firmware enthalten?

Ja, so zumindest die Intention, nachdem ich mich durch die API gewühlt habe. Leider konnte ich den Code noch nicht auf echter Hardware testen.

Erledigt per Fix 1-Wire multi-platform support again · hiveeyes/terkin-datalogger@bfc1fad · GitHub, jetzt könnte es stimmen.

New PR up.

1 Like

Weil wir auch gerade beim umbenennen sind: hx711.py gibts zweimal - einmal in driver und einmal in lib.
Python kommt bestimmt damit klar, mich verwirt es aber. :slight_smile:
Vielleicht bei einem/beiden ein Präfix? Für den MAX17043 wird es das gleiche Problem.

1 Like

I hear you. Das eine ist der lowlevel/hardwarenahe Teil, das andere ist der Adapter für die Terkin-Sensordomäne. Dass beide Dateien gleich heißen, kann in der Tat verwirrend sein, so dass ich ebenfalls gerne eine bessere Benamsung dafür haben wollen würde.

Vielleicht finden wir hier gemeinsam passende Vorschläge dafür. Naheliegend wäre z.B. hx711_adapter.py oder hx711_sensor.py. Durch die Länge trägt das allerdings im Logfile recht auf, dort stünde dann [terkin.driver.hx711_sensor ] als Präfix vor jeder entsprechenden Zeile im Log. Das ist aber vielleicht das geringere Übel als die Verwirrung durch die identische Namensgebung.

Erledigt. Danke!

Last but not least: Vielen vielen Dank dafür!

24 posts were merged into an existing topic: Entwicklung der Terkin-Sandbox

Nachdem ich bei Entwicklung der Terkin-Sandbox ff. erfolgreich war, bekomme ich nun folgende Meldung auf einem TTGO T-Call:

MicroPython v1.12 on 2019-12-20; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>>
>>> import machine ; machine.reset()
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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4844
load:0x40078000,len:10532
load:0x40080400,len:6736
entry 0x400806f0
I (525) psram: This chip is ESP32-D0WD
I (526) spiram: Found 64MBit SPI RAM device
I (526) spiram: SPI RAM mode: flash 40m sram 40m
I (529) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (536) cpu_start: Pro cpu up.
I (540) cpu_start: Application information:
I (544) cpu_start: Compile time:     Dec 20 2019 07:52:43
I (550) cpu_start: ELF file SHA256:  0000000000000000...
I (556) cpu_start: ESP-IDF:          v3.3
I (561) cpu_start: Starting app cpu, entry point is 0x40083d90
I (553) cpu_start: App cpu up.
I (1437) spiram: SPI SRAM memory test OK
I (1438) heap_init: Initializing. RAM available for dynamic allocation:
I (1438) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1444) heap_init: At 3FFBA658 len 000259A8 (150 KiB): DRAM
I (1450) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1457) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1463) heap_init: At 400973F0 len 00008C10 (35 KiB): IRAM
I (1469) cpu_start: Pro cpu start user code
I (146) cpu_start: Chip Revision: 1
W (146) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it.
I (150) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
[boot.py] INFO: Python module search path is: ['', '/lib']
[boot.py] INFO: Universal MicroPython Application Loader (umal)
[umal]    INFO: Python module search path is: ['/lib-mpy-1.11-bytecode', '', '/lib', '/dist-packages', '/terkin']
[main.py] INFO: Loading settings
[main.py] INFO: Starting logging
[main.py] INFO: Loading Terkin Datalogger
[main.py] INFO: Loading modules
I (18440) modsocket: Initializing
   22.7680 [terkin.datalogger           ] INFO   : Starting Terkin datalogger
   22.9930 [terkin.configuration        ] INFO   : Starting TerkinConfiguration on path "/"
   23.2160 [terkin.configuration        ] INFO   : Ensuring existence of backup directory at "/backup"
   23.5140 [terkin.configuration        ] INFO   : User settings: None
   23.7810 [terkin.device               ] ERROR  : Enabling Terminal failed
Traceback (most recent call last):
  File "/lib/terkin/device.py", line 45, in __init__
  File "/lib/terkin/device.py", line 470, in start
ValueError: UART(0) is disabled (dedicated to REPL)

   24.3980 [terkin.device               ] INFO   : Reset cause and wakeup reason: {'reset_cause': {'code': 5, 'message': 'SOFT'}, 'wakeup_reason': {'code': 0, 'message': 'UNKNOWN'}}
   24.6240 [terkin.watchdog             ] INFO   : Skipping watchdog timer (WDT)
   24.8450 [terkin.device               ] INFO   : Start curating the garbage collector
   25.2670 [terkin.device               ] INFO   : Collecting garbage
   25.7260 [terkin.device               ] INFO   : Curating the garbage collector finished. Free memory: 3912784
   25.9480 [terkin.device               ] WARNING: FIXME: Skip touching Bluetooth on vanilla MicroPython platforms as we don't use Bluetooth yet
   26.1750 [terkin.datalogger           ] INFO   : Starting Terkin MicroPython Datalogger 0.6.0
   26.4070 [terkin.configuration        ] INFO   : Configuration settings:
   26.6610 [terkin.configuration        ] INFO   : Section "telemetry": {"targets": [{"enabled": true, "topology": "mqttkit", "endpoint": "mqtt://daq.example.org", "address": {"network": "testdrive", "gateway": "area-42", "node": "node-01-mqtt-json", "realm": "workbench"}}, {"enabled": false, "topology": "mqttkit", "endpoint": "https://daq.example.org/api", "address": {"network": "testdrive", "gateway": "area-42", "node": "node-01-http-json", "realm": "workbench"}}, {"topology": "mqttkit", "interface": "gprs", "address": {"network": "testdrive", "gateway": "area-42", "node": "node-01-http-json", "realm": "workbench"}, "enabled": false, "endpoint": "https://daq.example.org/api"}, {"enabled": false, "data": {"key": "## redacted ##"}, "endpoint": "https://test.free.beeceptor.com/api/sensors"}, {"format": "lpp", "content_encoding": "base64", "address": {"network": "testdrive", "gateway": "area-42", "node": "node-01-mqtt-lpp", "realm": "workbench"}, "enabled": false, "endpoint": "mqtt://daq.example.org"}, {"enabled": true, "settings": {"size": 12, "datarate": 0}, "endpoint": "lora://", "format": "lpp"}]}
   26.9830 [terkin.configuration        ] INFO   : Section "interfaces": {"uart0": {"terminal": true}}
   27.2190 [terkin.configuration        ] INFO   : Section "main": {"interval": {"maintenance": 15.0, "field": 60.0}, "logging": {"enabled": true, "configuration": true}, "rgb_led": {"terkin": false, "heartbeat": true}, "deepsleep": false, "watchdog": {"enabled": false, "timeout": 60000}, "backup": {"file_count": 7}}
   27.4790 [terkin.configuration        ] INFO   : Section "networking": {"wifi": {"stations": [{"ssid": "FooBar", "password": "## redacted ##"}], "enabled": true, "phy": {"antenna_external": false, "antenna_pin": "P12"}}, "lora": {"enabled": false, "otaa": {"adr": false, "region": "EU868", "application_key": "## redacted ##", "application_eui": "## redacted ##", "device_eui": "<GENERATED_FROM_LORA_MAC>"}, "antenna_attached": false}, "gprs": {"pin_reset": "P5", "enabled": false, "apn": "apn.example.net", "pin_power": "P23", "driver": "pythings-sim800", "pin_txd": "P26", "pin_rxd": "P27", "pin_pwrkey": "P4"}}
   27.7940 [terkin.configuration        ] INFO   : Section "sensors": {"system": [{"type": "system.memfree"}, {"type": "system.temperature"}, {"type": "system.uptime"}, {"type": "system.wifi"}, {"enabled": false, "type": "system.touch-buttons"}, {"enabled": true, "resistor_r2": 1000, "pin": "P16", "description": "Battery", "type": "system.voltage.battery", "resistor_r1": 1000, "adc_attenuation_db": 6.0}, {"enabled": false, "resistor_r2": 100, "pin": "P17", "description": "Solar Panel", "type": "system.voltage.solar", "resistor_r1": 1000, "adc_attenuation_db": 11.0}], "environment": [{"pin_dout": "P22", "scale": 4.424242, "offset": -73000, "enabled": true, "name": "scale", "description": "Waage 1", "id": "scale-1", "number": 0, "pin_pdsck": "P21", "type": "HX711"}, {"enabled": true, "bus": "onewire:0", "name": "temperature", "description": "Wabengasse 1", "id": "ds18b20-1", "type": "DS18B20", "devices": [{"id": "ds18b20-r1c1", "enabled": true, "address": "1111111111111111", "description": "Reihe 1, Spalte 1"}, {"id": "ds18b20-r1c2", "enabled": true, "address": "2222222222222222", "description": "Reihe 1, Spalte 2"}]}, {"id": "bme280-1", "description": "Temperatur und Feuchte außen", "type": "BME280", "address": 119, "enabled": true, "bus": "i2c:0"}], "busses": [{"id": "bus-i2c-0", "family": "i2c", "number": 0, "pin_sda": "P9", "enabled": true, "pin_scl": "P10"}, {"id": "bus-i2c-1", "family": "i2c", "number": 1, "pin_sda": "P22", "enabled": false, "pin_scl": "P21"}, {"enabled": true, "family": "onewire", "pin_data": "P11", "id": "bus-onewire-0", "number": 0}], "prettify_log": true}
   28.1630 [terkin.configuration        ] INFO   : Section "services": {"api": {"modeserver": {"enabled": true}, "http": {"enabled": false}}}
   28.6630 [terkin.device               ] INFO   :

===================================
Terkin MicroPython Datalogger 0.6.0
===================================
Device id    30aea4c28138

CPU freq     160.0   MHz

Python  : 3.4.0
machine : ESP32 module (spiram) with ESP32
nodename: esp32
release : 1.12.0
sysname : esp32
version : v1.12 on 2019-12-20


   28.9060 [terkin.device               ] INFO   : Starting networking
   29.1470 [terkin.network.wifi         ] INFO   : Starting stopwatch
   29.7850 [terkin.network.wifi         ] INFO   : Started stopwatch successfully
   30.0160 [terkin.network.wifi         ] INFO   : WiFi STA: Will exclusively use STA mode on this platform. AP mode not implemented yet.
I (35000) wifi: wifi driver task: 3ffc5380, prio:23, stack:3584, core=0
I (43318) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (43328) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (43368) wifi: wifi firmware version: aeed694
I (43368) wifi: config NVS flash: enabled
I (43368) wifi: config nano formating: disabled
I (43368) wifi: Init dynamic tx buffer num: 32
I (43368) wifi: Init data frame dynamic rx buffer num: 32
I (43378) wifi: Init management frame dynamic rx buffer num: 32
I (43378) wifi: Init management short buffer num: 32
I (43388) wifi: Init static rx buffer size: 1600
I (43388) wifi: Init static rx buffer num: 10
I (43388) wifi: Init dynamic rx buffer num: 32
   30.3370 [terkin.network.wifi         ] INFO   : WiFi STA: Networking address (MAC): {}
   30.5580 [terkin.network.wifi         ] INFO   : WiFi STA: Networking address (IP):  ('0.0.0.0', '0.0.0.0', '0.0.0.0', '0.0.0.0')
   30.7800 [terkin.network.wifi         ] INFO   : WiFi: Starting interface
I (44158) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0
I (44158) wifi: mode : sta (30:ae:a4:c2:81:38)
I (44158) wifi: STA_START
   31.1000 [terkin.network.wifi         ] INFO   : WiFi STA: Preparing connection to network "FooBar"
   31.3260 [terkin.network.wifi         ] INFO   : WiFi STA: Starting connection to "FooBar" with timeout of 15.0 seconds
   31.9720 [terkin.network.wifi         ] INFO   : WiFi STA: Waiting for network to come up within 2.0 seconds
I (46698) wifi: STA_DISCONNECTED, reason:201
no AP found
   34.4510 [terkin.network.wifi         ] INFO   : WiFi STA: Waiting for network to come up within 15.001 seconds
I (49188) wifi: STA_DISCONNECTED, reason:201
no AP found
   37.8870 [terkin.network.wifi         ] INFO   : WiFi STA: Waiting for network to come up within 11.565 seconds
I (51268) wifi: STA_DISCONNECTED, reason:201
no AP found
I (53348) wifi: STA_DISCONNECTED, reason:201
no AP found
   40.8620 [terkin.network.wifi         ] INFO   : WiFi STA: Waiting for network to come up within 8.59 seconds
I (55448) wifi: STA_DISCONNECTED, reason:201
no AP found
   43.8380 [terkin.network.wifi         ] INFO   : WiFi STA: Waiting for network to come up within 5.615 seconds
I (57538) wifi: STA_DISCONNECTED, reason:201
no AP found
I (59628) wifi: STA_DISCONNECTED, reason:201
no AP found
   46.8140 [terkin.network.wifi         ] INFO   : WiFi STA: Waiting for network to come up within 2.639 seconds
I (61718) wifi: STA_DISCONNECTED, reason:201
no AP found
   49.8000 [terkin.network.wifi         ] ERROR  : WiFi STA: Connecting to "FooBar" failed
Traceback (most recent call last):
  File "/lib/terkin/network/wifi.py", line 281, in connect_stations
  File "/lib/terkin/network/wifi.py", line 355, in connect_station
WiFiException: WiFi STA: Unable to connect to "FooBar"

   50.0420 [terkin.network.wifi         ] INFO   : WiFi STA: Forgetting NVRAM data for network "FooBar"
I (63808) wifi: STA_DISCONNECTED, reason:201
no AP found
   50.6920 [terkin.network.wifi         ] ERROR  : WiFi STA: Connecting to any network candidate failed. Please check your WiFi configuration for one of the 1 station candidates.
   50.9190 [terkin.network.wifi         ] WARNING: Todo: We might want to buffer telemetry data to flash memory to be scheduled for transmission later.
   51.1530 [terkin.network.wifi         ] ERROR  : WiFi STA: Connecting to configured networks "['FooBar']" failed
Traceback (most recent call last):
  File "/lib/terkin/network/wifi.py", line 176, in connect_once
  File "/lib/terkin/network/wifi.py", line 298, in connect_stations
WiFiException: WiFi STA: Connecting to any network candidate failed

   51.3960 [terkin.network.wifi         ] INFO   : Starting WiFi connection monitor
   52.0330 [terkin.network.core         ] INFO   : Waiting for the network stack to come up within 5 seconds
   52.2560 [terkin.network.wifi         ] INFO   : WiFi STA: Connecting to configured networks: ['FooBar']. Attempt: #1
I (65928) wifi: STA_DISCONNECTED, reason:201
no AP found
   52.6930 [terkin.network.wifi         ] INFO   : WiFi STA: Preparing connection to network "FooBar"
   52.9200 [terkin.network.wifi         ] INFO   : WiFi STA: Starting connection to "FooBar" with timeout of 15.0 seconds   53.1440 [terkin.network.core         ] INFO   : Network stack ready

   53.3850 [terkin.network.core         ] INFO   : Starting mode server on 0.0.0.0:666
   53.6250 [terkin.device               ] INFO   : [LoRa] This is not a LoRa capable device.
   53.8510 [terkin.network.ip           ] INFO   : Starting UdpServer on 0.0.0.0:666

***ERROR*** A stack overflow in task mp_thread has been detected.
abort() was called at PC 0x4008df38 on core 1

ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000

Backtrace: 0x4008dbcb:0x3ffca300 0x4008df21:0x3ffca320 0x4008df38:0x3ffca340 0x40093702:0x3ffca360 0x4009540c:0x3ffca380 0x400953c2:0x00000000

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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4844
load:0x40078000,len:10532
load:0x40080400,len:6736
entry 0x400806f0
I (525) psram: This chip is ESP32-D0WD
I (526) spiram: Found 64MBit SPI RAM device
I (526) spiram: SPI RAM mode: flash 40m sram 40m
I (529) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (536) cpu_start: Pro cpu up.
I (540) cpu_start: Application information:
I (544) cpu_start: Compile time:     Dec 20 2019 07:52:43
I (550) cpu_start: ELF file SHA256:  0000000000000000...
I (556) cpu_start: ESP-IDF:          v3.3
I (561) cpu_start: Starting app cpu, entry point is 0x40083d90
I (553) cpu_start: App cpu up.
I (1437) spiram: SPI SRAM memory test OK
I (1438) heap_init: Initializing. RAM available for dynamic allocation:
I (1438) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1444) heap_init: At 3FFBA658 len 000259A8 (150 KiB): DRAM
I (1450) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1457) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1463) heap_init: At 400973F0 len 00008C10 (35 KiB): IRAM
I (1469) cpu_start: Pro cpu start user code
I (146) cpu_start: Chip Revision: 1
W (146) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it.
I (150) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
[boot.py] INFO: Python module search path is: ['', '/lib']
[boot.py] INFO: Universal MicroPython Application Loader (umal)
[umal]    INFO: Python module search path is: ['/lib-mpy-1.11-bytecode', '', '/lib', '/dist-packages', '/terkin']
[main.py] INFO: Loading settings
[main.py] INFO: Starting logging
[main.py] INFO: Loading Terkin Datalogger
[main.py] INFO: Loading modules

Ohne IP-Stack schmeckt ihm wohl der Modeserver nicht. Bitte deaktiviere ihn kurzerhand bei:

Ok, schaut schon mal anders aus:

>>> ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4844
load:0x40078000,len:10532
load:0x40080400,len:6736
entry 0x400806f0
I (525) psram: This chip is ESP32-D0WD
I (525) spiram: Found 64MBit SPI RAM device
I (525) spiram: SPI RAM mode: flash 40m sram 40m
I (528) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (535) cpu_start: Pro cpu up.
I (539) cpu_start: Application information:
I (544) cpu_start: Compile time:     Dec 20 2019 07:52:43
I (550) cpu_start: ELF file SHA256:  0000000000000000...
I (556) cpu_start: ESP-IDF:          v3.3
I (561) cpu_start: Starting app cpu, entry point is 0x40083d90
I (0) cpu_start: App cpu up.
I (1436) spiram: SPI SRAM memory test OK
I (1437) heap_init: Initializing. RAM available for dynamic allocation:
I (1437) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1443) heap_init: At 3FFBA658 len 000259A8 (150 KiB): DRAM
I (1450) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1456) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1463) heap_init: At 400973F0 len 00008C10 (35 KiB): IRAM
I (1469) cpu_start: Pro cpu start user code
I (145) cpu_start: Chip Revision: 1
W (146) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it.
I (149) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
[boot.py] INFO: Python module search path is: ['', '/lib']
[boot.py] INFO: Universal MicroPython Application Loader (umal)
[umal]    INFO: Python module search path is: ['/lib-mpy-1.11-bytecode', '', '/lib', '/dist-packages', '/terkin']
[main.py] INFO: Loading settings
[main.py] INFO: Starting logging
[main.py] INFO: Loading Terkin Datalogger
[main.py] INFO: Loading modules
I (18560) modsocket: Initializing
   22.9520 [terkin.datalogger           ] INFO   : Starting Terkin datalogger
   23.1770 [terkin.configuration        ] INFO   : Starting TerkinConfiguration on path "/"
   23.4000 [terkin.configuration        ] INFO   : Ensuring existence of backup directory at "/backup"
   23.6970 [terkin.configuration        ] INFO   : User settings: None
   24.3420 [terkin.device               ] INFO   : Reset cause and wakeup reason: {'reset_cause': {'code': 1, 'message': 'PWRON'}, 'wakeup_reason': {'code': 0, 'message': 'UNKNOWN'}}
   24.5690 [terkin.watchdog             ] INFO   : Skipping watchdog timer (WDT)
   24.7900 [terkin.device               ] INFO   : Start curating the garbage collector
   25.2120 [terkin.device               ] INFO   : Collecting garbage
   25.6710 [terkin.device               ] INFO   : Curating the garbage collector finished. Free memory: 3912816
   25.8930 [terkin.device               ] WARNING: FIXME: Skip touching Bluetooth on vanilla MicroPython platforms as we don't use Bluetooth yet
   26.1200 [terkin.datalogger           ] INFO   : Starting Terkin MicroPython Datalogger 0.6.0
   26.3510 [terkin.configuration        ] INFO   : Configuration settings:
   26.6050 [terkin.configuration        ] INFO   : Section "telemetry": {"targets": [{"enabled": false, "topology": "mqttkit", "endpoint": "mqtt://swarm.hiveeyes.org", "address": {"network": "testdrive", "gateway": "area-42", "node": "node-01-mqtt-json", "realm": "workbench"}}, {"enabled": false, "topology": "mqttkit", "endpoint": "https://daq.example.org/api", "address": {"network": "testdrive", "gateway": "area-42", "node": "node-01-http-json", "realm": "workbench"}}, {"topology": "mqttkit", "interface": "gprs", "address": {"network": "testdrive", "gateway": "area-005", "node": "t-call-cg-01", "realm": "hiveeyes"}, "enabled": true, "endpoint": "https://swarm.hiveeyes.org/api"}, {"enabled": false, "data": {"key": "## redacted ##"}, "endpoint": "https://test.free.beeceptor.com/api/sensors"}, {"format": "lpp", "content_encoding": "base64", "address": {"network": "testdrive", "gateway": "area-42", "node": "node-01-mqtt-lpp", "realm": "workbench"}, "enabled": false, "endpoint": "mqtt://daq.example.org"}, {"enabled": true, "settings": {"size": 12, "datarate": 0}, "endpoint": "lora://", "format": "lpp"}]}
   26.9250 [terkin.configuration        ] INFO   : Section "interfaces": {"uart0": {"terminal": false}}
   27.1610 [terkin.configuration        ] INFO   : Section "main": {"interval": {"maintenance": 15.0, "field": 60.0}, "logging": {"enabled": true, "configuration": true}, "rgb_led": {"terkin": false, "heartbeat": true}, "deepsleep": false, "watchdog": {"enabled": false, "timeout": 60000}, "backup": {"file_count": 7}}
   27.4200 [terkin.configuration        ] INFO   : Section "networking": {"wifi": {"stations": [{"ssid": "FooBar", "password": "## redacted ##"}], "enabled": false, "phy": {"antenna_external": false, "antenna_pin": "P12"}}, "lora": {"enabled": false, "otaa": {"adr": false, "region": "EU868", "application_key": "## redacted ##", "application_eui": "## redacted ##", "device_eui": "<GENERATED_FROM_LORA_MAC>"}, "antenna_attached": false}, "gprs": {"pin_reset": "P5", "enabled": true, "apn": "internet.telekom", "pin_power": "P23", "driver": "pythings-sim800", "pin_txd": "P26", "pin_rxd": "P27", "pin_pwrkey": "P4"}}
   27.7380 [terkin.configuration        ] INFO   : Section "sensors": {"system": [{"type": "system.memfree"}, {"type": "system.temperature"}, {"type": "system.uptime"}, {"type": "system.wifi"}, {"enabled": false, "type": "system.touch-buttons"}, {"enabled": true, "resistor_r2": 1000, "pin": "P16", "description": "Battery", "type": "system.voltage.battery", "resistor_r1": 1000, "adc_attenuation_db": 6.0}, {"enabled": false, "resistor_r2": 100, "pin": "P17", "description": "Solar Panel", "type": "system.voltage.solar", "resistor_r1": 1000, "adc_attenuation_db": 11.0}], "environment": [{"pin_dout": "P22", "scale": 4.424242, "offset": -73000, "enabled": true, "name": "scale", "description": "Waage 1", "id": "scale-1", "number": 0, "pin_pdsck": "P21", "type": "HX711"}, {"enabled": true, "bus": "onewire:0", "name": "temperature", "description": "Wabengasse 1", "id": "ds18b20-1", "type": "DS18B20", "devices": [{"id": "ds18b20-r1c1", "enabled": true, "address": "1111111111111111", "description": "Reihe 1, Spalte 1"}, {"id": "ds18b20-r1c2", "enabled": true, "address": "2222222222222222", "description": "Reihe 1, Spalte 2"}]}, {"id": "bme280-1", "description": "Temperatur und Feuchte außen", "type": "BME280", "address": 119, "enabled": true, "bus": "i2c:0"}], "busses": [{"id": "bus-i2c-0", "family": "i2c", "number": 0, "pin_sda": "P9", "enabled": true, "pin_scl": "P10"}, {"id": "bus-i2c-1", "family": "i2c", "number": 1, "pin_sda": "P22", "enabled": false, "pin_scl": "P21"}, {"enabled": true, "family": "onewire", "pin_data": "P11", "id": "bus-onewire-0", "number": 0}], "prettify_log": true}
   28.1080 [terkin.configuration        ] INFO   : Section "services": {"api": {"modeserver": {"enabled": false}, "http": {"enabled": false}}}
   28.6070 [terkin.device               ] INFO   :

===================================
Terkin MicroPython Datalogger 0.6.0
===================================
Device id    30aea4c28138

CPU freq     160.0   MHz

Python  : 3.4.0
machine : ESP32 module (spiram) with ESP32
nodename: esp32
release : 1.12.0
sysname : esp32
version : v1.12 on 2019-12-20


   28.8500 [terkin.device               ] INFO   : Starting networking
   29.0910 [terkin.network.wifi         ] INFO   : Starting stopwatch
   29.7280 [terkin.network.wifi         ] INFO   : Started stopwatch successfully
   29.9590 [terkin.device               ] INFO   : [WiFi] interface disabled in settings.
   30.1800 [terkin.device               ] INFO   : [LoRa] This is not a LoRa capable device.
I (37320) uart: ALREADY NULL
   46.2050 [terkin.device               ] INFO   : Starting telemetry
   46.4420 [terkin.telemetry            ] INFO   : Telemetry channel topology: MqttKitTopology
   46.6790 [terkin.telemetry            ] INFO   : Telemetry channel URI: https://swarm.hiveeyes.org/api/hiveeyes/testdrive/area-005/t-call-cg-01
   46.9030 [terkin.telemetry            ] INFO   : Starting Terkin TelemetryClient
   47.1420 [terkin.telemetry            ] INFO   : Telemetry channel topology: IdentityTopology
   47.3680 [terkin.telemetry            ] INFO   : Telemetry channel URI: lora://
   47.5910 [terkin.telemetry            ] INFO   : Starting Terkin TelemetryClient
   47.8420 [terkin.sensor.core          ] INFO   : Starting all busses [{'enabled': True, 'family': 'i2c', 'pin_scl': 'P10', 'pin_sda': 'P9', 'id': 'bus-i2c-0', 'number': 0}, {'enabled': False, 'family': 'i2c', 'pin_scl': 'P21', 'pin_sda': 'P22', 'id': 'bus-i2c-1', 'number': 1}, {'pin_data': 'P11', 'id': 'bus-onewire-0', 'number': 0, 'family': 'onewire', 'enabled': True}]
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d3730  PS      : 0x00060730  A0      : 0x800e111e  A1      : 0x3ffc1c30
A2      : 0x00000725  A3      : 0x3ff53000  A4      : 0x3ffb0094  A5      : 0x00000120
A6      : 0x00000000  A7      : 0x3ffc4368  A8      : 0x800d3730  A9      : 0x3ffc1c10
A10     : 0xffffffff  A11     : 0x400828c8  A12     : 0x3ffc4368  A13     : 0x00000000
A14     : 0x3ffc4370  A15     : 0x00000001  SAR     : 0x00000014  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000  LBEG    : 0x40096d7c  LEND    : 0x40096d87  LCOUNT  : 0xffffffff

ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000

Backtrace: 0x400d3730:0x3ffc1c30 0x400e111b:0x3ffc1c50 0x400e8f36:0x3ffc1c80 0x400e953a:0x3ffc1ca0 0x400dfd19:0x3ffc1d00 0x400ed216:0x3ffc1d30 0x400e3e68:0x3ffc1dd0 0x400dfaa1:0x3ffc1e00 0x400dfb09:0x3ffc1e20 0x400edc45:0x3ffc1e40 0x400e3e68:0x3ffc1ee0 0x400dfaa1:0x3ffc1f60 0x400dfb09:0x3ffc1f80 0x400edc45:0x3ffc1fa0 0x400e3e68:0x3ffc2040 0x400dfaa1:0x3ffc2070 0x400dfb09:0x3ffc2090 0x400edc45:0x3ffc20b0 0x400e3e68:0x3ffc2150 0x400dfaa1:0x3ffc2180 0x400dfb09:0x3ffc21a0 0x400edc45:0x3ffc21c0 0x400e3e68:0x3ffc2260 0x400dfaa1:0x3ffc22e0 0x400edbb9:0x3ffc2300 0x400e3e68:0x3ffc23a0 0x400dfaa1:0x3ffc2400 0x400dface:0x3ffc2420 0x40104b58:0x3ffc2440 0x40104dcd:0x3ffc24e0 0x40104e2b:0x3ffc2500 0x400f5ad5:0x3ffc2520 0x40092d59:0x3ffc2550

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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4844
load:0x40078000,len:10532
load:0x40080400,len:6736
entry 0x400806f0
I (525) psram: This chip is ESP32-D0WD
E (526) spiram: SPI RAM enabled but initialization failed. Bailing out.
I (526) cpu_start: Failed to init external RAM; continuing without it.
I (533) cpu_start: Pro cpu up.
I (537) cpu_start: Application information:
I (542) cpu_start: Compile time:     Dec 20 2019 07:52:43
I (548) cpu_start: ELF file SHA256:  0000000000000000...
I (554) cpu_start: ESP-IDF:          v3.3
I (558) cpu_start: Starting app cpu, entry point is 0x40083d90
I (550) cpu_start: App cpu up.
I (569) heap_init: Initializing. RAM available for dynamic allocation:
I (576) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (582) heap_init: At 3FFBA658 len 000259A8 (150 KiB): DRAM
I (588) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (594) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (601) heap_init: At 400973F0 len 00008C10 (35 KiB): IRAM
I (607) cpu_start: Pro cpu start user code
I (290) cpu_start: Chip Revision: 1
W (291) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it.
I (294) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
E (40) spiram: SPI RAM not initialized
[boot.py] INFO: Python module search path is: ['', '/lib']
[boot.py] INFO: Universal MicroPython Application Loader (umal)
[umal]    INFO: Python module search path is: ['/lib-mpy-1.11-bytecode', '', '/lib', '/dist-packages', '/terkin']
[main.py] INFO: Loading settings
[main.py] INFO: Starting logging
[main.py] INFO: Loading Terkin Datalogger
[main.py] INFO: Loading modules
Traceback (most recent call last):
  File "main.py", line 59, in <module>
  File "main.py", line 37, in main
  File "/lib/terkin/datalogger.py", line 14, in <module>
  File "/lib/terkin/device.py", line 13, in <module>
MemoryError: memory allocation failed, allocating 578 bytes
MicroPython v1.12 on 2019-12-20; ESP32 module (spiram) with ESP32
Type "help()" for more information.
1 Like

import pycom von weiter oben verschoben nach

datalogger.py, line 279

        try:
            import pycom
            interval_minutes = pycom.nvs_get('deepsleep')
            log.info('Deep sleep interval set to %s minute(s) by LoRaWAN downlink message', interval_minutes)
            interval = interval_minutes * 60
        # Otherwise, fall back to original configuration setting.
        except Exception as ex:
            interval = self.settings.get('main.interval.field')

3 posts were merged into an existing topic: Unlocking and improving the Pythings SIM800 GPRS module for MicroPython

It looks like SPIRAM fails sporadically on your device.

When the device has no SPIRAM, it’s not able to allocate enough memory for loading all MicroPython modules.

Bummer!

2 posts were merged into an existing topic: Unlocking and improving the Pythings SIM800 GPRS module for MicroPython