Making Xiao into a Trmnl

Illustration

A while ago I got myself a Trmnl device. However, I didn’t really want to use it for its Trmnl capabilities (which are admittedly great). What I wanted is to use Trmnl firmware with my server. And support for Trmnl firmware was the reason I got myself XIAO 7.5" ePaper Panel. I mean, it even comes with Trmnl firmware flashing instructions.

So, with Xiao display in my hand I tried following the instructions only to mostly fail. Why I say “mostly”? Well, display didn’t work and it still had picture that came from factory. But, since I was using my own server, I could easily see that it actually did communicate to my server. It did everything I expected it to, except showing the image.

The next step was, of course, contacting support. After following their steps, display did update using Arduino examples. But I didn’t want those - I wanted Trmnl firmware. So, I decided to dig into a Trmnl firmware itself. And one of the first thing I saw was that ESP32-C3 support was just added in 1.5.6. So much for the device supporting Trmnl firmware out of box. :)

Looking into source, it was easy to see that it contained defines for BOARD_TRMNL and BOARD_SEEED_XIAO_ESP32C3. The following was GPIO config for BOARD_TRMNL:

#define EPD_SCK_PIN  7
#define EPD_MOSI_PIN 8
#define EPD_CS_PIN   6
#define EPD_RST_PIN  10
#define EPD_DC_PIN   5
#define EPD_BUSY_PIN 4

And BOARD_SEEED_XIAO_ESP32C3 had these:

#define EPD_SCK_PIN  8
#define EPD_MOSI_PIN 10
#define EPD_CS_PIN   3
#define EPD_RST_PIN  2
#define EPD_DC_PIN   5
#define EPD_BUSY_PIN 4

Yep, e-paper control constants were completely different fitting what I saw happening. Firmware was running due to the same microcontroller. But Trmnl firmware literally couldn’t communicate with my display.

Fix was easy. I simply ignored instructions provided as method 1. Since I didn’t want to use old firmware, I also ignored method 2. This nicely led me to method 3. Building directly from source.

I already had PlatformIO installed from before so I only needed to figure out how to flash the firmware. What worked for me was holding “Boot” button and pressing “Reset”. Then wait for 2-3 seconds and press “Reset” twice in row. Sometimes it would be ok to double-click “Reset” only - but not every time. In PlatformIO one can now select seeed_xiao_esp32c3 as a device and upload working firmware.

With the properly firmware uploaded, my device finally worked. Curiously, the only thing missing was reading battery voltage. Worst case scenario, this will need a bit of hardware modification to work. But that is story for another time.