2022-12-02 01:17:14 -05:00
|
|
|
# Tillitis TKey Quickstart
|
2022-09-19 02:51:11 -04:00
|
|
|
|
|
|
|
This document describes how to build the FPGA bitstream, including the
|
2022-09-26 04:58:14 -04:00
|
|
|
firmware, and get this programmed onto the flash memory of the
|
2022-12-02 01:17:14 -05:00
|
|
|
Tillitis TKey USB device.
|
2022-09-19 02:51:11 -04:00
|
|
|
|
2022-12-02 01:17:14 -05:00
|
|
|
*Note well*: If you have a TKey which already has been flashed, then
|
|
|
|
you don't need to do anything unless you want to set your own Unique
|
|
|
|
Device Secret (UDS). You can start running apps on it immediately. See
|
2022-10-20 11:02:09 -04:00
|
|
|
[tillitis-key1-apps](https://github.com/tillitis/tillitis-key1-apps)
|
|
|
|
for a few examples.
|
|
|
|
|
2022-12-02 01:17:14 -05:00
|
|
|
The Tillitis TKey kit includes:
|
2022-09-19 02:51:11 -04:00
|
|
|
|
2022-12-02 01:17:14 -05:00
|
|
|
- Tillitis TKey USB stick with USB-C plug, marked MTA1-USB V1
|
2022-09-26 04:58:14 -04:00
|
|
|
- Programmer board based on Raspberry Pi Pico, with a white holder/jig
|
|
|
|
- USB cable with micro-B plug, for connecting the programmer to
|
2022-09-19 02:51:11 -04:00
|
|
|
computer
|
2022-09-26 04:58:14 -04:00
|
|
|
- USB-C extension cable
|
2022-09-19 02:51:11 -04:00
|
|
|
- USB-C to USB-A adapter
|
|
|
|
|
2022-12-02 01:17:14 -05:00
|
|
|
## Programming FPGA bitstream and firmware onto TKey
|
2022-09-20 10:34:58 -04:00
|
|
|
|
2022-09-26 04:58:14 -04:00
|
|
|
Connect the programmer to the computer using the USB cable with
|
|
|
|
micro-B plug.
|
2022-09-19 02:51:11 -04:00
|
|
|
|
2022-12-02 01:17:14 -05:00
|
|
|
Place the TKey USB stick correctly in the programming jig and close
|
|
|
|
the hatch.
|
2022-09-19 02:51:11 -04:00
|
|
|
|
2022-09-26 04:58:14 -04:00
|
|
|
The USB stick can remain in the jig during repeated development,
|
|
|
|
programming and testing cycles. The USB stick should then be connected
|
|
|
|
to the computer using the provided USB-C cable (use the USB-C-to-A
|
2022-09-29 15:20:28 -04:00
|
|
|
adapter if needed). The jig also has a cutout to allow touching where
|
2023-03-01 05:50:24 -05:00
|
|
|
the touch sensor is located (next to the LED on the outer edge). Note
|
|
|
|
that connecting the USB stick to the computer is not required for
|
|
|
|
programming it. Note also that with this setup, to reset the USB stick
|
|
|
|
back to firmware mode after loading an app, you need to unplug both
|
|
|
|
the USB cable to the stick and the one to the programmer.
|
|
|
|
Alternatively, you can try the script in
|
|
|
|
`../hw/application_fpga/tools/reset-tk1` which pokes at the TKey
|
|
|
|
that's sitting in the jig, leaving it in firmware mode so that a new
|
|
|
|
app can be loaded.
|
2022-09-26 04:58:14 -04:00
|
|
|
|
|
|
|
On Linux, `lsusb` should list the connected programmer as `cafe:4004
|
|
|
|
Blinkinlabs ICE40 programmer`. If the USB stick is also connected it
|
|
|
|
shows up as `1207:8887 Tillitis MTA1-USB-V1`.
|
2022-09-19 02:51:11 -04:00
|
|
|
|
|
|
|
To install the software needed for building and programming, please
|
|
|
|
refer to [toolchain_setup.md](toolchain_setup.md).
|
|
|
|
|
2022-09-26 04:58:14 -04:00
|
|
|
You are now ready to generate the FPGA bitstream (including building
|
|
|
|
the standard firmware) and program it onto the flash memory of the USB
|
2022-10-20 11:02:09 -04:00
|
|
|
stick. Note that this will give a default Unique Device Secret. If you
|
2022-12-02 01:17:14 -05:00
|
|
|
want to personalize your TKey, see under Device personalization below
|
2022-10-20 11:02:09 -04:00
|
|
|
first.
|
|
|
|
|
|
|
|
The following should be run as your regular non-root user, but
|
2022-09-26 04:58:14 -04:00
|
|
|
the programming is currently done using `sudo` (so sudo is expected to
|
|
|
|
be set up for your user; the Makefile runs `sudo tillitis-iceprog …`).
|
2022-09-19 02:51:11 -04:00
|
|
|
|
|
|
|
```
|
|
|
|
$ git clone https://github.com/tillitis/tillitis-key1
|
|
|
|
$ cd tillitis-key1/hw/application_fpga
|
|
|
|
$ make prog_flash
|
|
|
|
```
|
|
|
|
|
2022-12-02 01:17:14 -05:00
|
|
|
After programming, the TKey can be connected to your computer (use the
|
|
|
|
USB-C-to-A adapter if needed) and will boot the firmware. When boot
|
2023-03-01 05:50:24 -05:00
|
|
|
has completed the LED will be steady white. This indicates that it is
|
|
|
|
ready to receive and measure an app.
|
2022-09-20 10:34:58 -04:00
|
|
|
|
2022-09-21 02:55:13 -04:00
|
|
|
To try out an app, continue to the README.md the apps repo:
|
|
|
|
https://github.com/tillitis/tillitis-key1-apps#readme
|
|
|
|
|
|
|
|
To learn more about the concepts and workings of the firmware, see:
|
|
|
|
[system_description/system_description.md](system_description/system_description.md)
|
|
|
|
and [system_description/software.md](system_description/software.md).
|
|
|
|
|
2022-10-20 11:02:09 -04:00
|
|
|
## Device personalization - setting Unique Device Secret (UDS)
|
|
|
|
|
2022-12-02 01:17:14 -05:00
|
|
|
To personalize your TKey you need to modify the Unique Device Secret
|
|
|
|
(UDS) and, maybe, the Unique Device Identity (UDI).
|
2022-10-20 11:02:09 -04:00
|
|
|
|
|
|
|
The simplest way to generate a new UDS is to:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ cd tillitis-key1/hw/application_fpga
|
|
|
|
$ make secret
|
|
|
|
```
|
|
|
|
|
|
|
|
Then proceed with the `make prog_flash` as discussed above.
|
2022-09-20 10:34:58 -04:00
|
|
|
|
2022-10-20 11:02:09 -04:00
|
|
|
In detail: You need to modify the hex file that contains the Unique
|
|
|
|
Device Secret (UDS). You might also want to update the Unique Device
|
|
|
|
Identity (UDI). These hex files are located in
|
2022-09-26 04:58:14 -04:00
|
|
|
`hw/application_fpga/data/`. Note that after modify the files in this
|
|
|
|
directory, you need to rebuild and program the device again (as
|
|
|
|
above).
|
|
|
|
|
|
|
|
To make this easier there is a tool that can generate these files. The
|
2022-10-20 11:02:09 -04:00
|
|
|
tool can be found in `hw/application_fpga/tools/tpt`. The tool by
|
|
|
|
default allow you to supply a secret used as part of the UDS
|
|
|
|
generation and only generates a new `uds.hex`. See `--help` for more
|
|
|
|
flags.
|