First Go at Tildagon Development

The “Tildagon” is the badge which was first available at EMF 2024 (which went to and also wrote enthused about). It has an ESP32-S3 microcontroller, two USB-C ports, 6 “hexpansion” ports, and a bunch of buttons and LEDs. Time to see what we can do with it!

Flashing new firmware

First hurdle is to flash the latest firmware onto the badge. As per the documentation this should be fairly straightforward. However – as you may be familiar with if you’ve read other posts here – things are rarely straightforward on this hell of a system of my own creation ^^;;

And indeed, the first thing that happened was a “Failed to execute open on ttyACM0: failed to open serial port” error. Well then. What info can we get about ttyACM0?

$ ls -l /dev/ttyACM0
crw-rw---- 1 root uucp 166, 0 Jun  5 22:03 /dev/ttyACM0

Aha! That probably explains things: I am not in the uucp group, which might be a problem. One

$ sudo usermod -aG uucp thomas

and a quick restart of my X session later (not sure if that was necessary, but just restarting the browser didn’t seem to fix things) the web flasher was a lot happier. I even got this exciting diff of messages on dmesg:

dmesg before:

[ 1922.020701] cdc_acm 1-2:1.0: ttyACM0: USB ACM device
[ 2034.564555] usb 1-2: USB disconnect, device number 9
[ 2042.866145] usb 1-2: new full-speed USB device number 10 using xhci_hcd
[ 2043.007865] usb 1-2: New USB device found, idVendor=303a, idProduct=1001, bcdDevice= 1.01
[ 2043.007881] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2043.007887] usb 1-2: Product: USB JTAG/serial debug unit
[ 2043.007892] usb 1-2: Manufacturer: Espressif
[ 2043.007897] usb 1-2: SerialNumber: 64:E8:33:72:09:64

dmesg after:

[ 2043.010922] cdc_acm 1-2:1.0: ttyACM0: USB ACM device
[ 2044.782506] usb 1-2: USB disconnect, device number 10
[ 2045.072881] usb 1-2: new full-speed USB device number 11 using xhci_hcd
[ 2045.224475] usb 1-2: New USB device found, idVendor=16d0, idProduct=120e, bcdDevice= 1.00
[ 2045.224491] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2045.224498] usb 1-2: Product: TiLDAGON
[ 2045.224504] usb 1-2: Manufacturer: Electromagnetic Field
[ 2045.224509] usb 1-2: SerialNumber: 123456

Look at that! We now have the product correctly declared as “TilDAGON”, the manufacturer as “Electromagnetic Field”, and the serial number as nonsense 123456. Neat!

Setting up for simulation

Rather than running a buggy app directly on the hardware, the Tildagon software repo comes with a handy simulator. Once again however, I need to slightly change things:

  • It turns out I’m missing some libraries: wasmer – “Universal Binaries Powered by WebAssembly”. That one is easily fixable via pacman -S wasmer, thankfully.
  • Unfortunately pipenv does not and will never support version ranges (pipenv#1050), and wasmer wheels currently only build for up to python3.10 (Arch ships 3.12.3 at the time of writing).
    sigh
    Turns out however, that pyenv is a thing which a allows you to easily manage multiple python installations. Well, somewhat easily: after running
    $ pyenv install 3.10 && pyenv local 3.10
    
    you then use the configured version by wrapping the command in pyenv exec. Not exactly seamless, but better than nothing I guess. It does lead to this mildly ridiculous invocation:
    $ pyenv exec pipenv run python run.py
    
    “Yo dawg, I heard you like running things, so I put running things in your things that run things.”

At last, the simulator successfully runs.

Getting ready for development

Licenses

From a cursory browse on GitHub searching for “tildagon app”, it seems the base software repo has no license, and people release their apps under a wide variety of licenses. I I found several projects without a license (aka. all rights reserved (this is not legal advice, I am not a lawyer, etc. etc.)), the Unlicense, GPL-3.0-or-later, MPL-2.0, etc. Am I being overly cautious here? Almost definitely. But it just feels best to be clear about these things.

I’m going to go with BSD-3-Clause, because it is one I’m familiar with, it’s reasonably loose and so people can learn from it (which I love the idea of!), I like that commercial use requires explicit permission, and in this case I don’t mind improvements not necessarily making it back. I’m of course hoping they will, but I’m not going to require it.

With the boring bureaucracy out of the way, let’s move on to setting up a development environment.

Brief notes from tonight (2024-06-17)

  • Can we set up an environment? With several libs spread across places
    • Thread the dependencies and libraries somehow?
    • Might be simpler not to and just use the docs (what I’ve been doing so far).
  • Seems the app must be in a file called app.py. Naming it anything else causes it to not be detected in the simulator, despite a corresponding __init__.py pointing to the right place.
  • LEDs seem to be indexed from 1, based on the examples out there. Corresponds to the labelling on the PCB.
  • Using the ctx.arc function causes a TypeError! That’s exciting!
  • And I’ve clearly done something wrong: my timer logic causes the entire simulator to hang… ^^;;
Thomas Ekström Hansen
Thomas Ekström Hansen
PhD student in Computer Science

My interests include information visualisation, formal methods, and low-level programming.

Previous

Related