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

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