|
| 1 | +--- |
| 2 | +title: Set up your environment |
| 3 | +weight: 2 |
| 4 | + |
| 5 | +### FIXED, DO NOT MODIFY |
| 6 | +layout: learningpathall |
| 7 | +--- |
| 8 | + |
| 9 | +## Set up your environment |
| 10 | + |
| 11 | +In this section, you will prepare your host computer and identify the hardware needed for two Zephyr shell examples. You will use the shell over two transports: |
| 12 | + |
| 13 | +- MQTT over Ethernet |
| 14 | +- UART over a USB serial connection |
| 15 | + |
| 16 | +By the end of this section, you will know which boards to use, which host tools to install, and how the Zephyr shell fits into an embedded application. |
| 17 | + |
| 18 | +## Before you begin |
| 19 | + |
| 20 | +Make sure you have a working Zephyr development environment set up in Visual Studio Code using the Workbench for Zephyr extension, including: |
| 21 | + |
| 22 | +- The Workbench for Zephyr extension installed |
| 23 | +- A Zephyr SDK toolchain imported in Workbench |
| 24 | +- A West workspace initialized |
| 25 | + |
| 26 | +If you have not done this yet, complete [Build Zephyr projects with Workbench for Zephyr in VS Code learnin path](/learning-paths/embedded-and-microcontrollers/zephyr_vsworkbench/) first. |
| 27 | + |
| 28 | +You also need: |
| 29 | + |
| 30 | +- Docker Desktop, Docker Engine, or another Docker-compatible runtime |
| 31 | +- A USB cable for each development board |
| 32 | + |
| 33 | +## Hardware requirements |
| 34 | + |
| 35 | +For the MQTT shell example, use a Zephyr-supported development board with Ethernet. The instructions use the [FRDM-MCXN947](https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXN947), with the Zephyr board identifier `frdm_mcxn947/mcxn947/cpu0`. |
| 36 | + |
| 37 | +For the UART shell example, use a Zephyr-supported development board with a USB UART interface. The instructions use the [FRDM-MCXN947](https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXN947), with the Zephyr board identifier `frdm_mcxn947/mcxn947/cpu0`. |
| 38 | + |
| 39 | +To check whether another board is supported by Zephyr, refer to the [Zephyr Supported Boards list](https://docs.zephyrproject.org/latest/boards/index.html). |
| 40 | + |
| 41 | +## Install UART terminal tools |
| 42 | + |
| 43 | +For the UART shell example, install a serial terminal application on your host computer. You will use the terminal application to connect to the Zephyr shell over the board's UART interface. |
| 44 | + |
| 45 | +### Windows |
| 46 | + |
| 47 | +Install [PuTTY](https://www.putty.org/index.html), which provides a lightweight serial terminal for UART communication. |
| 48 | + |
| 49 | +After installation: |
| 50 | + |
| 51 | +1. Connect the development board over USB. |
| 52 | + |
| 53 | +2. Open **Device Manager** and locate the board's COM port under **Ports (COM & LPT)**. |
| 54 | + |
| 55 | +3. Open PuTTY and configure: |
| 56 | + |
| 57 | + - **Connection type**: `Serial` |
| 58 | + |
| 59 | + - **Serial line**: your board's COM port (for example `COM5`) |
| 60 | + |
| 61 | + - **Speed**: `115200` |
| 62 | + |
| 63 | +Select **Open** to connect to the Zephyr UART shell. |
| 64 | + |
| 65 | +<p style="text-align:center;"> |
| 66 | + <img src="/learning-paths/embedded-and-microcontrollers/zephyr_shell/images/putty_installation.png" |
| 67 | + alt="PuTTY Installation" |
| 68 | + width="640" |
| 69 | + style="max-width:100%;height:auto;" /> |
| 70 | + <br/> |
| 71 | + <em>PuTTY Serial Terminal Configuration</em> |
| 72 | +</p> |
| 73 | + |
| 74 | +### macOS |
| 75 | + |
| 76 | +macOS includes a built-in UART terminal utility through the `screen` command, so no additional software is required. |
| 77 | + |
| 78 | +After connecting the development board over USB: |
| 79 | + |
| 80 | +1. Open a terminal window. |
| 81 | + |
| 82 | +2. List available serial devices: |
| 83 | + |
| 84 | +```bash |
| 85 | + |
| 86 | +ls /dev/tty.* |
| 87 | + |
| 88 | +``` |
| 89 | + |
| 90 | +3. Identify the board's serial device. |
| 91 | + |
| 92 | +4. Connect to the UART shell with: |
| 93 | + |
| 94 | +```bash |
| 95 | + |
| 96 | +screen /dev/tty.usbmodemXXXX 115200 |
| 97 | + |
| 98 | +``` |
| 99 | + |
| 100 | +Replace `/dev/tty.usbmodemXXXX` with the serial device shown on your system. |
| 101 | + |
| 102 | +To exit `screen`: |
| 103 | + |
| 104 | +1. Press `Ctrl + A` |
| 105 | + |
| 106 | +2. Press `K` |
| 107 | + |
| 108 | +3. Press `Y` to confirm |
| 109 | + |
| 110 | +{{% notice Note %}} |
| 111 | + |
| 112 | +Workbench for Zephyr supports multiple debug runners depending on the connected board. The FRDM-MCXN947 board uses the onboard CMSIS-DAP / LinkServer interface for flashing and debugging, while shell access in this Learning Path uses UART over USB. |
| 113 | + |
| 114 | +{{% /notice %}} |
| 115 | + |
| 116 | +## Network requirements |
| 117 | + |
| 118 | +For the MQTT shell example, the board needs access to an MQTT broker over Ethernet. You will run Mosquitto locally with Docker Compose and use the Mosquitto command-line tools to send and receive shell messages. |
| 119 | + |
| 120 | +Make sure that: |
| 121 | + |
| 122 | +- The board is connected to the same network as the host computer. |
| 123 | +- The network provides DHCP, or you configure a static IPv4 address in `prj.conf`. |
| 124 | +- The board can reach the MQTT broker on port `1883`. |
| 125 | + |
| 126 | +{{% notice Note %}} |
| 127 | +The example configuration uses IPv4. If your network does not provide DHCP, use the static IPv4 settings shown in the next section. |
| 128 | +{{% /notice %}} |
| 129 | + |
| 130 | +## What's next? |
| 131 | + |
| 132 | +In the next section, you will read a short overview of the Zephyr shell subsystem and the two transports used in this Learning Path. After that, you will build the MQTT shell and the UART shell on the FRDM-MCXN947 using a USB serial connection and a UART terminal application such as PuTTY or the built-in macOS `screen` utility. |
0 commit comments