Running the Terkin-Datalogger on a Heltec WiFi LoRa 32

I would like to run our Micropython based Terkin datalogging Firmware on the Heltec WiFi LoRa 32 devices.

It looks like @RalfL and @permagriculture might have some experiences with operating these devices, eventually using MicroPython already.

Does anyone have any pointers how to get started?

As a general question would be to me, what parts do i need to have same as pycom devices and what do i not need.
Do we have a howto, or something, where someone flashed terkin-datalogger to a ESP32? What are the steps (e.g. after installing the micropython firmware)?

@poesel You have been working with other ESP32 based modules pycom ?

I have used terkin on a TTGO T8 & TTGO T-Call (disclaimer: not in the field, yet).
You just need to flash the mpy firmware as described here:
https://docs.micropython.org/en/latest/esp32/tutorial/intro.html
From then on the ESP32 behaves like a pycom device. You can use the same tools. ‘make install’ does work as does syncing it with VSC.

Hi, Thanks for your reply.

I had success on adding micropython to the board:

esptool.py --port /dev/ttyUSB1 erase_flash
esptool.py --chip esp32 --port /dev/ttyUSB1 --baud 460800 write_flash -z 0x1000 ~/Downloads/esp32-idf3-20200413-v1.12-357-g740946736.bin

But when trying to install our firmware on the device, I am getting errors, which seems, that the /flash/ is not there/accessible/… .

$ make install-ng
Unable to create /flash/lib
Unable to copy 'hiveeyes-micropython-firmware/src/pybytes_config.json' to '/flash'
Unable to copy 'hiveeyes-micropython-firmware/src/settings.py' to '/flash'
[...]
Unable to create /flash/lib-mpy
Unable to create /flash/lib-mpy

Do I miss some other partitioning on the device?

/flash doesn’t exist when using Genuine MicroPython. I think you need to set these two settings in your presets.mk:

# Use "bytecode" or "pycom" here for Genuine MicroPython vs. Pycom MicroPython.
MPY_TARGET ?= pycom

# Specify MicroPython version.
MPY_VERSION ?= 1.11

to bytecode and 1.12. IIRC that sets it right – like:

# Use "bytecode" or "pycom" here for Genuine MicroPython vs. Pycom MicroPython.
MPY_TARGET ?= bytecode

# Specify MicroPython version.
MPY_VERSION ?= 1.12
1 Like

see Entwicklung der Terkin-Sandbox

With the current state of GitHub - hiveeyes/terkin-datalogger: Terkin-Datalogger for MicroPython, we will have to fill some gaps to support LoRa on Genuine MicroPython. Out of the box, it will currently only work on Pycom’s LoPy4 and FiPy devices.

Thanks for sharing this funny article. I’ve referenced the pure-Python LoRa driver he conceived within LoRa support for Genuine MicroPython.

Thanks @poesel , that helped. Now install-ng does its job. But as thanks to @Andreas it has been pointed out,

that there are some other obstacles on the path that need to be jumped over, or better spoken, digged in, under and out on the other side. First is here.

MicroPython v1.12-357-g740946736 on 2020-04-13; ESP32 module with ESP32
Type "help()" for more information.
>>> 
>>> 
MPY: soft reboot
[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', '/dist-packages', '/lib-mpy', '']
[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 61, in <module>
  File "main.py", line 39, 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

When i find time, I might start digging and report here!

The error message was the same at the TTGO T-Call:

… but contrary to the TTGO T-Call, the Heltec LoRa 32 really has no PSRAM.

1 Like