Entwicklung der Terkin-Sandbox

pip==20.0.1 macht wohl die Probleme. 19.3.1 funktioniert, wird aber beim Setup immer auf 20.0.1 angehoben.

Edit: gefixt mit

1 Like

@poesel also wants to use the cross-compilation procedure for uploading the firmware to a device running vanilla MicroPython 1.12.

What I am observing is…

root@Calvin:/home/markus/GitHub/terkin-datalogger# make install-ng
Device port: usb => /dev/ttyS3
make[1]: Entering directory '/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger'
[INFO]    Uploading MicroPython code to device using USB
make[1]: Leaving directory '/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger'
make[1]: Entering directory '/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger'
make[2]: Entering directory '/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger'
Device port: usb => /dev/ttyS3
.venv3/bin/rshell --port /dev/ttyS3 --user micro --password python --buffer-size 2048 mkdir /flash/dist-packages
Using buffer-size of 2048
Connecting to /dev/ttyS3 (buffer-size 2048)...
Trying to connect to REPL .. connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/ /dist-packages/ /lib/ /main.py/ /project.pymakr/ /terkin/ /settings.py/ /backup/
Setting time ... Feb 16, 2020 16:24:06
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
Unable to create /flash/dist-packages
.venv3/bin/rshell --port /dev/ttyS3 --user micro --password python --buffer-size 2048 rsync dist-packages /flash/dist-packages
Using buffer-size of 2048
Connecting to /dev/ttyS3 (buffer-size 2048)...
Trying to connect to REPL .... connected
Testing if ubinascii.unhexlify exists ... b"ets Jun  8 2016 00:22:57\r\n\r\nrst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)\r\nconfigsip: 0, SPIWP:0xee\r\nclk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00\r\nmode:DIO, clock div:2\r\nload:0x3fff0018,len:4\r\nload:0x3fff001c,len:4844\r\nload:0x40078000,len:10532\r\nload:0x40080400,len:6736\r\nentry 0x400806f0\r\n\x1b[0;32mI (534) psram: This chip is ESP32-D0WD\x1b[0m\r\n\x1b[0;32mI (534) spiram: Found 64MBit SPI RAM device\x1b[0m\r\n\x1b[0;32mI (534) spiram: SPI RAM mode: flash 40m sram 40m\x1b[0m\r\n\x1b[0;32mI (537) spiram: PSRAM initialized, cache is in low/high (2-core) mode.\x1b[0m\r\n\x1b[0;32mI (544) cpu_start: Pro cpu up.\x1b[0m\r\n\x1b[0;32mI (548) cpu_start: Application information:\x1b[0m\r\n\x1b[0;32mI (553) cpu_start: Compile time:     Dec 20 2019 07:52:43\x1b[0m\r\n\x1b[0;32mI (559) cpu_start: ELF file SHA256:  0000000000000000...\x1b[0m\r\n\x1b[0;32mI (565) cpu_start: ESP-IDF:          v3.3\x1b[0m\r\n\x1b[0;32mI (570) cpu_start: Starting app cpu, entry point is 0x40083d90\x1b[0m\r\n\x1b[0;32mI (562) cpu_start: App cpu up.\x1b[0m\r\n\x1b[0;32mI (1446) spiram: SPI SRAM memory test OK\x1b[0m\r\n\x1b[0;32mI (1446) heap_init: Initializing. RAM available for dynamic allocation:\x1b[0m\r\n\x1b[0;32mI (1446) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM\x1b[0m\r\n\x1b[0;32mI (1452) heap_init: At 3FFBA658 len 000259A8 (150 KiB): DRAM\x1b[0m\r\n\x1b[0;32mI (1459) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM\x1b[0m\r\n\x1b[0;32mI (1465) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM\x1b[0m\r\n\x1b[0;32mI (1472) heap_init: At 400973F0 len 00008C10 (35 KiB): IRAM\x1b[0m\r\n\x1b[0;32mI (1478) cpu_start: Pro cpu start user code\x1b[0m\r\n\x1b[0;32mI (154) cpu_start: Chip Revision: 1\x1b[0m\r\n\x1b[0;33mW (155) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it.\x1b[0m\r\n\x1b[0;32mI (158) cpu_start: Starting scheduler on PRO CPU.\x1b[0m\r\n\x1b[0;32mI (0) cpu_start: Starting scheduler on APP CPU.\x1b[0m\r\n[boot.py] INFO: Python module search path is: ['', '/lib']\r\n[boot.py] INFO: Universal MicroPython Application Loader (umal)\r\n[umal]    INFO: Python module search path is: ['/lib-mpy-1.11-bytecode', '', '/lib', '/dist-packages', '/terkin']\r\n[main.py] INFO: Loading settings\r\n[main.py] INFO: Starting logging\r\n[main.py] INFO: Loading Terkin Datalogger\r\n[main.py] INFO: Loading modules\r\n"
Traceback (most recent call last):
  File "/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger/.venv3/lib/python3.7/site-packages/rshell/main.py", line 1255, 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 8, in <module>
    sys.exit(main())
  File "/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger/.venv3/lib/python3.7/site-packages/rshell/command_line.py", line 4, in main
    rshell.main.main()
  File "/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger/.venv3/lib/python3.7/site-packages/rshell/main.py", line 2843, in main
    real_main()
  File "/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger/.venv3/lib/python3.7/site-packages/rshell/main.py", line 2805, in real_main
    connect(args.port, baud=args.baud, wait=args.wait, user=args.user, password=args.password)
  File "/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger/.venv3/lib/python3.7/site-packages/rshell/main.py", line 1261, in connect
    connect_serial(port, baud=baud, wait=wait)
  File "/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger/.venv3/lib/python3.7/site-packages/rshell/main.py", line 1285, in connect_serial
    dev = DeviceSerial(port, baud, wait)
  File "/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger/.venv3/lib/python3.7/site-packages/rshell/main.py", line 1565, in __init__
    Device.__init__(self, pyb)
  File "/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger/.venv3/lib/python3.7/site-packages/rshell/main.py", line 1339, in __init__
    unhexlify_exists = self.remote_eval(test_unhexlify)
  File "/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger/.venv3/lib/python3.7/site-packages/rshell/main.py", line 1459, in remote_eval
    return eval(self.remote(func, *args, **kwargs))
  File "/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger/.venv3/lib/python3.7/site-packages/rshell/main.py", line 1437, in remote
    self.pyb.enter_raw_repl()
  File "/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger/.venv3/lib/python3.7/site-packages/rshell/pyboard.py", line 187, in enter_raw_repl
    raise PyboardError('could not enter raw repl')
rshell.pyboard.PyboardError: could not enter raw repl
make[2]: *** [Makefile:240: install-requirements] Error 1
make[2]: Leaving directory '/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger'
make[1]: *** [Makefile:217: install-rshell] Error 2
make[1]: Leaving directory '/mnt/c/Users/Markus/Documents/GitHub/terkin-datalogger'
make: *** [Makefile:227: install-ng] Error 2
  1. It looks like the program is still running. You might want to stop it firsthand.

  2. It looks like the process doesn’t pick up the cross-compiled directory yet. It should eventually be called "lib-mpy-1.12-bytecode".

… coming from Unlocking and improving the Pythings SIM800 GPRS module for MicroPython here. Thanks already!

Till now I have used MicroPython with PyCom devices and the fitting tools from PyCom like PyCom firmware updater, Atom with Pymkr, Terkin Sandbox. So what are the steps to unlock MicroPython on a “normal”, non-PyCom device as the TTGO T-Call?

I have sucessfully used the PyCom tool to erase the existing data on the devide with
pycom-fwtool-cli.exe --port COM6 erase_all

What worked also was: Installing the firmware TBEAMv1-1.20.2.rc3-0.8.0-vanilla-squirrel.tar.gz with

C:\Program Files (x86)\Pycom\Pycom Firmware Update>pycom-fwtool-cli.exe --port COM6 flash --tar TBEAMv1-1.20.2.rc3-0.8.0-vanilla-squirrel.tar.gz
Running in FTDI mode
Script Version: 2.1
Flash operation successful.

But I stall now with the next step install software. Can I use the Terkin Sandbox for this tasks or do I have to install other tools?

I have tried to access the REPL but had no luck neither with Atom / pymakr nor with the Terkin Sandbox:

root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware# make repl
Device port: usb => /dev/ttyS6
.venv3/bin/rshell --port /dev/ttyS6 --user micro --password python --buffer-size 2048 repl
Using buffer-size of 2048
Connecting to /dev/ttyS6 (buffer-size 2048)...
Trying to connect to REPL ....................Unable to connect to REPL

No MicroPython boards connected - use the connect command to add one

Unable to find board ''

Should it work? Is the TBEAM firmware working on the T-Call? Are the credentials --user micro --password python the same here? Any idea how to go on here?

[edit] When I update the firmware (via Windows shell) and switch directly after that to WSL and call make repl the REPL works, nice!

root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware# make repl
Device port: usb => /dev/ttyS6
.venv3/bin/rshell --port /dev/ttyS6 --user micro --password python --buffer-size 2048 repl
Using buffer-size of 2048
Connecting to /dev/ttyS6 (buffer-size 2048)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /flash/
Setting time ... Feb 19, 2020 11:01:35
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 1970
Entering REPL. Use Control-X to exit.
>
Pycom MicroPython 1.20.2.rc3-0.8.0-vanilla-squirrel [v1.20.2.rc3-11-g69432bb17-dirty] on 2020-02-11; TBEAMv1 with ESP32
Type "help()" for more information.
>>>

make install starts running but stopps after a time, I think because the REPL is no more available:

root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware# make install
Device port: usb => /dev/ttyS6
.venv3/bin/rshell --port /dev/ttyS6 --user micro --password python --buffer-size 2048 mkdir /flash/dist-packages
Using buffer-size of 2048
Connecting to /dev/ttyS6 (buffer-size 2048)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /flash/
Setting time ... Feb 19, 2020 11:13:22
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 1970
.venv3/bin/rshell --port /dev/ttyS6 --user micro --password python --buffer-size 2048 rsync dist-packages /flash/dist-packages
Using buffer-size of 2048
Connecting to /dev/ttyS6 (buffer-size 2048)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /flash/
Setting time ... Feb 19, 2020 11:13:23
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 1970
timed out or error in transfer to remote
.venv3/bin/rshell --port /dev/ttyS6 --user micro --password python --buffer-size 2048 --file tools/upload-framework.rshell
Using buffer-size of 2048
Connecting to /dev/ttyS6 (buffer-size 2048)...
Trying to connect to REPL ....................Unable to connect to REPL
Destination directory /flash/lib does not exist.
Unable to create /flash/lib/terkin
Destination directory /flash/lib/terkin does not exist.
.venv3/bin/rshell --port /dev/ttyS6 --user micro --password python --buffer-size 2048 --file tools/upload-sketch.rshell
Using buffer-size of 2048
Connecting to /dev/ttyS6 (buffer-size 2048)...
Trying to connect to REPL ....................Unable to connect to REPL

Hi Clemens,

bei MicroPython for ESP32 gibt es die Genuine MicroPython Firmware zum Download und eine entsprechende Anleitung dazu.

Vorbereitung

pip install esptool
wget https://micropython.org/resources/firmware/esp32spiram-idf3-20191220-v1.12.bin

Aufspielen

export MCU_PORT=/dev/ttyUSB0
esptool.py --port $MCU_PORT erase_flash
esptool.py --chip esp32 --port $MCU_PORT --baud 460800 write_flash -z 0x1000 esp32spiram-idf3-20191220-v1.12.bin

Viel Erfolg!

[edit, s.u.] ggf. auch die baudrate ändern, falls es nicht funktioniert

esptool.py --chip esp32 --port $MCU_PORT --baud 115200 write_flash -z 0x1000 esp32spiram-idf3-20191220-v1.12.bin
2 Likes

Ergänzend: ich habe bei mir die .bin files esp32spiram-idf3-20191220-v1.12.bin drauf - das sind meinem Verständnis nach die release binaries. Die anderen sind wohl die nightly builds.

Danke, ich habe den Eintrag entsprechend angepasst.

2 posts were merged into an existing topic: LoRa support for Genuine MicroPython

Hmmm, bin unter WSL, erase ging nun kommt aber das:

root@XPS13-CGruber:/home/cgruber/esptool# esptool.py --chip esp32 --port $MCU_PORT --baud 460800 write_flash -z 0x1000 esp32spiram-idf3-20191220-v1.12.bin
esptool.py v2.8
Serial port /dev/ttyS6
Connecting.....
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: xx:xx:xx:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...

A fatal error occurred: Timed out waiting for packet header

Hmm, das hat bei mir schon x-mal funktioniert. Probier mal ohne WSL. Musst Du nur /dev/ttyS6 gegen COM6 tauschen.

Edit: müsste das nicht ‘./esptool.py…’ heissen?

@Andreas gab mir gerade den Tipp mit der baud-Rate runter zu gehen, und tatsächlich, nun ging es mit --baud 115200! Danke!

Mein Rechner hängt an einem USB-Hub, an dem wieder ein Dell-Monitor hängt mit zwei USB-Buchsen und aus convenience-Gründen (aka “Faulheit”) hängt der T-Call gerade da dran. Direkt anstöpseln hat aber für das Problem auch nix gebracht, gerade getestet! Dann muss es das Kabel sein?! Ein anderes hat auch nicht besser funktioniert!

Mit der Genuine MicroPython Firmware kann ich nun problemlos über die Terkin-Sandbox die REPL aufmachen!

Allerdings gibt es nun Probleme beim Hochladen der Software beim Erstellen der Ordner:

Unable to create /flash/dist-packages
Unable to create /flash/lib/terkin

alles zusammen:

root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware# make install
Device port: usb => /dev/ttyS6
.venv3/bin/rshell --port /dev/ttyS6 --user micro --password python --buffer-size 2048 mkdir /flash/dist-packages
Using buffer-size of 2048
Connecting to /dev/ttyS6 (buffer-size 2048)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/
Setting time ... Feb 20, 2020 14:11:47
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
Unable to create /flash/dist-packages
.venv3/bin/rshell --port /dev/ttyS6 --user micro --password python --buffer-size 2048 rsync dist-packages /flash/dist-packages
Using buffer-size of 2048
Connecting to /dev/ttyS6 (buffer-size 2048)...
Trying to connect to REPL .. connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/
Setting time ... Feb 20, 2020 14:11:50
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
Destination directory /flash/dist-packages does not exist.
.venv3/bin/rshell --port /dev/ttyS6 --user micro --password python --buffer-size 2048 --file tools/upload-framework.rshell
Using buffer-size of 2048
Connecting to /dev/ttyS6 (buffer-size 2048)...
Trying to connect to REPL .. connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/
Setting time ... Feb 20, 2020 14:11:53
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
Destination directory /flash/lib does not exist.
Unable to create /flash/lib/terkin
Destination directory /flash/lib/terkin does not exist.
.venv3/bin/rshell --port /dev/ttyS6 --user micro --password python --buffer-size 2048 --file tools/upload-sketch.rshell
Using buffer-size of 2048
Connecting to /dev/ttyS6 (buffer-size 2048)...
Trying to connect to REPL .. connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/
Setting time ... Feb 20, 2020 14:11:56
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware#

Bei uPy gibt es das Verzeichnis /flash nicht.

1 Like

… dann macht die Fehlermeldung Sinn! ;-) Kann ich das fixen oder brauche ich da @Andreas zu? Habe jetzt einfach nur make install über die Terkin Sandbox ausgeführt. @poesel, du lädst die Sachen ja anders aufs Gerät.

In meinem PR sind ein paar fixes, die das mpy-cross compiling ermöglichen. Bis zum Install habe ich das aber dann nicht weiter verfolgt, weil .mpy-files das ganze nicht wesentlich schneller machen.
Ich synce Dateien eh anders, dafür benutze ich nicht die Sandbox.

cross compiling mache ich auch noch nicht, sondern nutze die Terkin Sandbox nur zum hochladen, weil die einzelnen Dateien im repo ja verteilt rumliegen und wir für die aktuelle / latest kein package haben.

Vermutlich muss ich dafür das Makefile anpassen, einfach flash/ raus?!

Hmmm, scheint nicht zu reichen, gibt noch die Fehlermeldung

Destination directory /flash/lib does not exist.
Unable to create /flash/lib/terkin
Destination directory /flash/lib/terkin does not exist.

Das kannst du ignorieren. Die mkdir-Variante in RSHELL kennt die -p Option nicht und meckert, wenn das Verzeichnis schon existiert. Nur beim ersten Upload solltest du diese Meldung NICHT sehen. Danach tut es keinen Schaden

Nur zum Verständnis, ich habe da keine Ahnung! Wenn ich make install aufrufe wir doch der code in Makefile aufgerufen. Reicht es wenn ich dort die Pfade z.B. von

install-requirements: check-mcu-port
	$(rshell) $(rshell_options) mkdir /flash/dist-packages
	$(rshell) $(rshell_options) rsync dist-packages /flash/dist-packages

nach

install-requirements: check-mcu-port
	$(rshell) $(rshell_options) mkdir /dist-packages
	$(rshell) $(rshell_options) rsync dist-packages /dist-packages

ändere? Das habe ich eigentlich gemacht und danach nochmal make install aufgerufen, dennoch kommt die Meldung oben, entweder ist der Pfad noch wo anders drinnen oder meine Änderungen wurden nicht angenommen.

Wir müssen hier noch nachlegen. Nach der Anpassung des install-requirements targets im Makefile noch in jenen Dateien:

Das stimmt in diesem Fall nicht ganz. Die Sandbox ist noch nicht darauf vorbereitet, mit non-/flash im Ziel umzugehen.

2 Likes

Stimmt auch, aber die Meldung kommt trotzdem vom mehrmaligen mkdir auf das gleiche Verzeichnis.