# How to physically connect a device

> How do I

<warning>

This article regards viewing device text `printf` or Zephyr Logging based logs.
For accessing TDF data stored on the data logger see <span>

WIP

</span>

.

</warning>

## Prerequisites

- Infuse-IoT Capable hardware with:

  - Zephyr's Logging (`CONFIG_LOG`) enabled
  - Serial or the programmer port.
- Python tools

## Device Logs

There are a few different ways to connect to a device:

- Accessing text logs and ePackets over RTT/Serial/PyOCD using `infuse gateway`.
- Accessing the text logs over Bluetooth using `infuse bt_log`.

<tabs>
<tabs-group icon="i-lucide-unplug" label="Direct connection">

This method uses `infuse gateway` to receive text logs and command gateways over serial links.
This method can be used to only receive text logs by using the `-d` flag (while will display data only).

<tip>

Text logs and ePacket data are exchanged over the `epacket_serial` device in devicetree. Refer to hardware
configuration of the firmware to determine which peripheral to use if there are multiple present.

</tip>

<tabs>
<tabs-group icon="i-lucide-cpu" label="RTT">

- Note the name of the microcontroller you are connecting to. e.g. for the nRF52840 - `nRF52840_xxAA`.
- Connect your JLink programmer
- To connect to an `nRF52840_xxAA` board run:

```text
infuse gateway --rtt nRF52840_xxAA
```

or replace with your board name as required.

</tabs-group>

<tabs-group icon="i-lucide-usb" label="Serial (UART/USB)">

- Connect your device to your computer via serial/usb
- Note the name of the serial port your device is connected to.
- To connect to `/dev/ttyACM0` run:

```text
infuse gateway --serial /dev/ttyACM0
```

or replace with your serial port as required.

<tip>

Attaching and detaching the device will cause the serial device to appear and disappear.
Checking which ports are present in Device Manager (Windows) or `ls /dev/tty*` for macOS/Linux
can be a good way to identify which port to use if there are multiple options.

If multiple ports appear at the same time, it's typically the one with the smaller value.

</tip>
</tabs-group>

<tabs-group icon="i-simple-icons-python" label="PyOCD">

- Note the name of the microcontroller you are connecting to e.g. `stm32l451ceux`
- Connect your programmer
- To connect to a `stm32l451ceux` board run:

```text
infuse gateway --pyocd stm32l451ceux
```

or replace with your board name as required.

</tabs-group>
</tabs>

You should now be connected to the board, wait for data to appear in the terminal.

</tabs-group>

<tabs-group icon="i-lucide-bluetooth" label="Bluetooth connection">
<tip>

This cannot be used to run gateway commands, and can only be used to view text logs.

</tip>

- Note the Infuse-ID of your device.
- Run the command:

```text
infuse bt_log --id 0x1234567890ABCDEF
```

</tabs-group>
</tabs>
