# <img alt="OpenSK logo" src="../img/OpenSK.svg" width="200px">

## Nordic nRF52840-DK board

![Nordic development kit](../img/devkit_annotated.jpg)

### Flashing using JTAG

The development board comes with its own JTAG port, so the default programmer
is the easiest and most convenient. You can flash OpenSK with these steps:

1.  Connect a micro USB cable to the JTAG USB port.

1.  Run our script for compiling/flashing Tock OS and OpenSK on your device:

    ```shell
    ./deploy.py --board=nrf52840dk_opensk --opensk
    ```

1.  Connect a micro USB cable to the device USB port.

**Note**: Due to current limitations of our implementation and Tock, you may
have to press the `BOOT/RESET` button, located next to the device USB port on
the board in order to see your OpenSK device on your system.

### Buttons and LEDs

Out of the 5 buttons, the group of 4 behaves identically. They all convey user
presence to the application. Some actions like register and login will make the
board blink, asking you to confirm the transaction with a button press. The
remaining fifth button restarts the board.

The group of 4 LEDs on the right show the state of the app. There are different
patterns:

| Pattern                            | Cause                  |
|------------------------------------|------------------------|
| LED1 slow blink                    | kernel panic           |
| all LEDs blinking together         | app panic              |
| LED1+4 and LED2+3 fast alternating | asking for touch       |
| fast swirling                      | wink (just saying Hi!) |
| circle                             | allocator panic        |

The LEDs closer to the JTAG port indicates the power and debugging state.

There are 3 switches that need to be in the correct position:

*   Power (bottom left): On
*   nRF power source (center left): VDD
*   SW6 (top right): DEFAULT

### Upgradability

There are variants of the board that introduce A/B partitions for upgrading the
firmware. You can bootstrap an upgradable board using one of the two commands:

```shell
./deploy.py --board=nrf52840dk_opensk_a --opensk
./deploy.py --board=nrf52840dk_opensk_b --opensk
```

Afterwards, you can upgrade the other partition with

```shell
./tools/perform_upgrade.sh nrf52840dk_opensk_b
./tools/perform_upgrade.sh nrf52840dk_opensk_a
```

respectively. You can only upgrade the partition that is not currently running,
so always alternate your calls to `perform_upgrade.sh`. Otherwise, this script
works like `deploy.py`. You can call it even after you locked down your device,
to deploy changes to your development board.
