meshtastic/docs/getting-started/flashing-firmware/esp32/cli-script.mdx

280 lines
6.5 KiB
Plaintext
Raw Normal View History

---
id: cli-script
title: Flashing with the CLI
2023-01-21 09:32:24 -08:00
sidebar_label: CLI Script (Advanced Users)
2022-10-31 10:27:04 -07:00
sidebar_position: 3
---
2021-12-07 20:50:23 -08:00
2023-01-19 05:01:57 -08:00
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
2023-01-21 09:32:24 -08:00
import Link from "@docusaurus/Link";
2022-04-29 14:39:06 -07:00
:::caution
Make sure not to power the radio on without first attaching the antenna! You could damage the radio chip!
:::
2022-11-02 11:46:54 -07:00
Before you flash your device start by verifying connectivity with the device being flashed. Outlined below are steps that can be taken to verify connectivity and, if necessary, to install the appropriate drivers. If you end up needing to install drivers be sure to reboot your computer afterwards to verify the installation is complete.
2021-05-15 18:48:24 -07:00
:::note
2024-01-24 21:52:20 -08:00
The [T-Beam 0.7](/docs/hardware/devices/tbeam/?t-beam=0.7) board is an earlier version of the T-Beam board, and due to changes in the design in subsequent iterations this board uses a specific firmware file different from the other T-Beam boards.
2021-05-15 18:48:24 -07:00
2023-10-25 11:56:53 -07:00
`firmware-tbeam0.7-X.X.X.xxxxxxx.bin` is the correct firmware. `firmware-tbeam-X.X.X.xxxxxxx.bin` is incompatible. For all other [T-Beam](/docs/hardware/devices/tbeam) boards `firmware-tbeam-X.X.X.xxxxxxx.bin` is the correct selection.
2021-05-15 18:48:24 -07:00
:::
## Command Line Interface Instructions
2024-01-20 22:58:34 -08:00
2023-06-29 15:13:33 -07:00
### Install Prerequisite Software
2024-01-20 22:58:34 -08:00
<Tabs
2021-12-07 20:50:23 -08:00
groupId="operating-system"
defaultValue="linux"
values={[
{label: 'Linux', value: 'linux'},
{label: 'macOS', value: 'macos'},
{label: 'Windows', value: 'windows'},
]}>
<TabItem value="linux">
2024-02-22 13:09:26 -08:00
#### Linux
2022-02-28 10:54:58 -08:00
Check if you have `python3` and `pip` installed with the following command
```shell
2022-02-28 10:54:58 -08:00
python3 --version
pip3 --version
```
If `python3` is not installed, install with
```shell
2022-02-28 10:54:58 -08:00
sudo apt-get update
sudo apt-get install python3
```
If `pip` is not installed, install with
```shell
2022-02-28 10:54:58 -08:00
sudo apt-get install python3-pip
```
</TabItem>
<TabItem value="macos">
2024-02-22 13:09:26 -08:00
#### macOS
2022-02-28 10:54:58 -08:00
OS X comes with `Python 2.7` installed, but not `pip`. The following uses Homebrew to install `python3` which includes `pip3`. On MacOS you will use `pip3` instead > of `pip`.
:::note
Check if you have Homebrew installed with the following command
2021-12-07 20:50:23 -08:00
```shell
brew -v
```
2021-12-07 20:50:23 -08:00
If it's not installed, follow the instructions on the [Homebrew website](https://brew.sh) before continuing.
:::
2022-02-28 10:54:58 -08:00
Check if you have `python3` and `pip` installed with the following command
```shell
2022-02-28 10:54:58 -08:00
python3 --version
pip3 --version
```
If `python3` is not installed, install with
Install Python3
```shell
2022-02-28 10:54:58 -08:00
brew install python3
```
Confirm `pip3` was installed alongside `python3`
```shell
2022-02-28 10:54:58 -08:00
pip3 -v
```
2021-05-15 11:36:15 -07:00
</TabItem>
<TabItem value="windows">
2024-02-22 13:09:26 -08:00
#### Windows
- Download and install [Python](https://www.python.org). When installing, make sure to click `Add Python X.Y to PATH`.
- Download and install [Gitbash](https://gitforwindows.org) (or other appropriate shell) and run all subsequent commands from that shell.
:::note
Confirm installation of `python` & `pip` with the following commands.
2021-12-07 20:50:23 -08:00
```shell
py --version
```
2021-12-07 20:50:23 -08:00
```shell
pip --version
```
2021-12-07 20:50:23 -08:00
:::
2023-06-29 15:13:33 -07:00
</TabItem>
</Tabs>
2021-12-07 20:50:23 -08:00
### Install `esptool`
```shell
2023-06-29 15:13:33 -07:00
pip3 install --upgrade esptool
2022-02-28 10:54:58 -08:00
```
### Confirm Communication With Chip
<Tabs
groupId="operating-system"
defaultValue="linux"
values={[
{label: 'Linux', value: 'linux'},
{label: 'macOS', value: 'macos'},
{label: 'Windows', value: 'windows'},
]}>
2024-01-20 22:58:34 -08:00
<TabItem value="linux">
2024-02-22 13:09:26 -08:00
#### Linux
2024-01-20 22:58:34 -08:00
:::important
On Linux, you may need to explicitly declare esptool as a .py script. Use `esptool.py chip_id`.
:::
</TabItem>
2022-05-27 15:00:21 -07:00
<TabItem value="macos">
2024-02-22 13:09:26 -08:00
#### macOS
2022-05-27 15:00:21 -07:00
:::important
On macOS, you may need to explicitly declare esptool as a .py script. Use `esptool.py chip_id`.
2022-05-27 15:00:21 -07:00
:::
</TabItem>
<TabItem value="windows">
2024-02-22 13:09:26 -08:00
#### Windows
:::important
On Windows, you must explicitly declare esptool as a .py script. Use `esptool.py chip_id`.
:::
</TabItem>
</Tabs>
Connect the radio to your computer using a data USB cable. Confirm your device is talking to your computer using the following command:
```shell title="Command"
2021-12-07 20:50:23 -08:00
esptool chip_id
```
```shell title="Expected Output"
2021-12-07 20:50:23 -08:00
# You should see a result similar to this:
mydir$ esptool chip_id
esptool.py v2.6
Found 2 serial ports
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: 24:6f:28:b5:36:71
Uploading stub...
Running stub...
Stub running...
Warning: ESP32 has no Chip ID. Reading MAC instead.
MAC: 24:6f:28:b5:36:71
Hard resetting via RTS pin...
```
### Navigate to Firmware
`cd` into the directory where you unzipped the latest release. For example:
2021-12-07 20:50:23 -08:00
```shell title="Example"
2022-01-02 22:53:45 -08:00
cd ~/Downloads/firmware/
```
### Install/Update Firmware
2021-12-07 20:50:23 -08:00
Install or Update the device that you have by using the following commands according to your operating system:
:::caution
2023-10-25 14:48:17 -07:00
Be very careful to install the correct firmware file for your board. In particular, the popular 'T-BEAM' radio from TTGO is not called 'TTGO-Lora' (that is a different board). So don't install the 'TTGO-Lora' build on a TBEAM, it won't work correctly. If you flash the incorrect device firmware, it may appear to successfully complete, yet the device will usually become unresponsive, displaying a blank screen (if equipped). Attempt to flash the correct version. Please note, while these devices are quite resilient and damage is not always likely, there is a possibility of onboard radio and peripheral damage due to incorrect GPIO pin direction.
:::
<Tabs
2021-12-07 20:50:23 -08:00
groupId="operating-system"
defaultValue="linux"
values={[
{label: 'Linux', value: 'linux'},
{label: 'macOS', value: 'macos'},
{label: 'Windows', value: 'windows'},
]}>
<TabItem value="linux">
2024-02-22 13:09:26 -08:00
#### Linux
##### Install
```shell title="Command"
2022-02-28 10:54:58 -08:00
./device-install.sh -f firmware-BOARD-VERSION.bin
```
2024-02-22 13:09:26 -08:00
##### Update
```shell title="Command"
2022-02-28 10:54:58 -08:00
./device-update.sh -f firmware-BOARD-VERSION.bin
```
</TabItem>
<TabItem value="macos">
2024-02-22 13:09:26 -08:00
#### macOS
##### Install
```shell title="Command"
2022-02-28 10:54:58 -08:00
./device-install.sh -f firmware-BOARD-VERSION.bin
```
2024-02-22 13:09:26 -08:00
##### Update
```shell title="Command"
2022-02-28 10:54:58 -08:00
./device-update.sh -f firmware-BOARD-VERSION.bin
```
</TabItem>
<TabItem value="windows">
2024-02-22 13:09:26 -08:00
#### Windows
##### Install
```shell title="Command"
device-install.bat -f firmware-BOARD-VERSION.bin
2022-02-28 10:54:58 -08:00
```
2024-02-22 13:09:26 -08:00
##### Update
```shell title="Command"
device-update.bat -f firmware-BOARD-VERSION.bin
2022-02-28 10:54:58 -08:00
```
</TabItem>
</Tabs>
2023-01-21 09:32:24 -08:00
## Connect and Configure Device
2023-01-21 09:32:24 -08:00
After flashing the Meshtastic firmware to the device, you can proceed with the initial configuration.
2023-01-21 09:32:24 -08:00
<div className="indexCtasBody">
<Link
className={"button button--outline button--lg cta--button"}
to={"/docs/getting-started/initial-config"}
>
Connect and Configure Device
</Link>
</div>