Before continuing, we recommend going through the [OpenThread Hardware
Codelab](https://codelabs.developers.google.com/codelabs/openthread-hardware/), which details how to set up your
environment and install all tools and software needed to flash the nRF52840 DK
board used in this guide.

<br />

> [!NOTE]
> **Note:** On Windows, SEGGER J-link is automatically installed with the nRF5x Command Line Tools. On Linux or MacOS, it must be installed separately.

<br />

## Build OpenThread

1. Clone the OpenThread repository, and switch to the [Thread Reference
   2018-09-26](https://github.com/openthread/openthread/releases/tag/thread-reference-20180926) release commit:

       git clone https://github.com/openthread/openthread

       cd openthread

       git checkout -b thread-reference-20180926

2. Install the GNU toolchain and other dependencies:

       ./script/bootstrap

3. Build the nRF52840 example. The `USB=1` switch enables [native
   USB CDC ACM as a serial transport](https://github.com/openthread/openthread/tree/master/examples/platforms/nrf52840#native-usb-support).

       make -f examples/Makefile-nRF52840 BORDER_AGENT=1 BORDER_ROUTER=1 COMMISSIONER=1 \
         DHCP6_CLIENT=1 DHCP6_SERVER=1 JOINER=1 MAC_FILTER=1 REFERENCE_DEVICE=1 \
         UDP_FORWARD=1 USB=1

## Flash and connect the NCP

![OTBR Nordic Connection](https://openthread.io/static/certification/images/otbr-cert-nordic-pi-conn.png)

See the [Flash the nRF52840](https://openthread.io/guides/ncp/firmware#flash_the_nrf52840) and
[Connect the nRF52840](https://openthread.io/guides/ncp/firmware#connect_the_nrf52840) steps from the
Pre-Built NCP Firmware guide for instructions on how to flash the nRF52840 DK
board as an NCP and connect it to the Raspberry Pi.

Similar instructions are also found in the [OpenThread Hardware
Codelab](https://codelabs.developers.google.com/codelabs/openthread-hardware/).

## Set up the Raspberry Pi

See the [Download and install the OS
step](https://openthread.io/guides/border-router/raspberry-pi#download-and-install-the-os) from
the Raspberry Pi 3B (RPi3B) Border Router platform page for instructions on how
to install the OS and configure the device.

In addition to the normal RPi3B setup and configuration, install `git` and
some recommended utilities:

    sudo apt-get install git screen tcpdump

## Set up OpenThread Border Router

1. Clone the OpenThread Border Router repository, and switch to the [Thread
   Certified 2018-08-19](https://github.com/openthread/ot-br-posix/releases/tag/thread-br-certified-20180819) release commit:

       git clone https://github.com/openthread/ot-br-posix

       cd ot-br-posix

       git checkout -b thread-br-certified-20180819

2. Install dependencies:

       ./script/bootstrap

3. Compile and install OTBR and `wpantund`, using the OTBR certification commit for `wpantund`:

       WPANTUND_COMMIT=8c189c6 ./script/setup

4. Open `/etc/wpantund.conf` and update the UART port for the nRF52840 DK NCP:

   ```
   Config:NCP:SocketPath '/dev/ttyACM0'
   ```
5. Restart the `wpantund` service:

       sudo service wpantund restart

The Border Router should now be up and running. See [OpenThread Border
Router](https://openthread.io/guides/border-router) for more information about OTBR.