# Setup Clank Firmware on Teensy 4.1

The Clank robot relies on a custom built Micropython binary for the MIMXRT port, which includes an experimental api for hardware based quadrature encoders. The reference implementation is tested using a Teensy 4.1 and code from [this PR to the micropython upstream repository](https://github.com/micropython/micropython/pull/7911) which is on Micropython 1.19.4 version. Other MIMXRT board should be sufficient, but this in unverified. Copies of these custom binaries are provided in the `firmware/hex` directory. Alternatively, you can attempt to build your own binaries from the PR's source following the [Build Micropython for the Teensy 4.0/4.1 ](https://androiddrew.github.io/2021/07/build-micropython-for-teensy-4x/) instructions.

## Flashing the Teensy 4.1 with Clank's custom firmware

Instructions for generically flashing the Teensy can be found on the pjrc website [here](https://www.pjrc.com/teensy/first_use.html). The below instructions were performed using an Ubuntu linux desktop. Instructions for flashing the Teensy from an Ubuntu desktop can be found [here](https://androiddrew.github.io/2021/07/build-micropython-for-teensy-4x/).

## Flashing the Teensy 4.1 with the upy_clank Micropython code

TODO add instructions for using mpremote to deploy `upy_clank` code to Teensy 4.1 microcontroller.