feat: unify companion builds and USB runtime modes

This commit is contained in:
mikecarper committed 2026-08-27 15:06:26 -07:00
1 parent 69ded9d6c7
commit 1d836c0473
31 files changed
+1425 -131

No files matched your search

+2 -2
View File
@@ -72,8 +72,8 @@ retain 50 because their MQTT discovery tables are constrained by internal DRAM.
| ESP32 MQTT observer or ESP-NOW bridge | Always uses the expanded FULL partition profile. The build never substitutes a reduced CLI to fit the legacy application slot. |
| FULL ESP32 USB + WiFi | Uses the matching MQTT target with packet logging on, verbose debug off, and the complete command surface supported by that role and hardware. `get/set logging.output off\|usb\|wifi\|both` selects and persists the active output paths. |
| FULL ESP32 logging fallback | Uses the matching non-MQTT target only when no WiFi MQTT sibling exists, with debug and packet logging enabled and the complete command surface supported by that role and hardware. Its persistent USB gate also covers output-off operation, avoiding a second FULL ESP-NOW image. |
| Dual-CDC Full Companion | nRF52 and qualified native-USB ESP32-S3 Full images use one physical USB connection. Fresh installs expose only interface `00` for framed Companion/terminal/mOTA traffic. Enabling logging and rebooting adds interface `02` for plaintext logs. They also provide BLE and source-only LoRa OTA; ESP32 additionally provides WiFi. `get/set usb.logging` persistently controls whether the logging interface is present. |
| Single-TTY Full Companion | ESP32 Full images without dual CDC start with framed Companion on their one TTY. `set usb.logging on` switches it to an input-capable plaintext logging terminal; `set usb.logging off` replies and then restores framed Companion automatically. BLE, WiFi, and source-only LoRa OTA remain available. |
| Dual-CDC Full Companion | nRF52 and qualified native-USB ESP32-S3 Full images use one physical USB connection. Fresh installs expose only interface `00`; it starts as an ASCII terminal and automatically hands a complete `<` frame to framed Companion. The same interface also carries exclusive serial mOTA traffic. Enabling logging and rebooting adds interface `02` for plaintext logs. They also provide BLE and source-only LoRa OTA; ESP32 additionally provides WiFi. `get/set usb.logging` persistently controls whether the logging interface is present. |
| Single-TTY Full Companion | ESP32 Full images without dual CDC start with the ASCII terminal on their one TTY and automatically hand a complete `<` frame to framed Companion. `set usb.logging on` switches it to an input-capable plaintext logging terminal; `set usb.logging off` replies and then restores framed Companion automatically. A saved logging-on setting starts directly in that logging terminal and disables automatic frame detection. BLE, WiFi, and source-only LoRa OTA remain available. |
| `no_external_sensors` | Removes optional external-sensor drivers and their settings; it does not remove core repeater discovery, routing, or runtime RS-232 commands. RAK3401 and RAK4631 profiles retain the four common INA I2C voltage/current monitors. GPS-preserving RAK nRF52 OTA profiles retain their GPS commands and provider; RAK4631 defaults the bridge to UART 2 because GPS uses UART 1. Legacy target suffixes remain stable for OTA identity compatibility. |
`logging`, `OTA`, and `FULL` describe independent build features in historical
+59 -24
View File
@@ -233,7 +233,7 @@ itself.
| Platform | Interface | Purpose |
| --- | --- | --- |
| Both | USB, 115200 baud | Binary Companion by default; terminal switch available |
| Both | USB, 115200 baud | ASCII after boot; automatically switches on the first complete Binary Companion frame |
| Both | BLE | Binary Companion; display builds show a random session PIN, while headless builds default to `123456` |
| ESP32 | TCP 5000 | Binary Companion over WiFi |
| ESP32 | HTTP 80 | Companion WebConfig and first-boot WiFi setup |
@@ -278,18 +278,29 @@ Expose them only on a trusted LAN or temporary setup network. See
## USB Binary and text terminal modes
USB starts in Binary mode for MeshCore apps and `meshcli`:
Full Companion USB starts in the ASCII terminal after boot. MeshCore apps and
`meshcli` send a `<`-prefixed framed command, which automatically hands the
untouched frame to the Binary Companion parser:
```bash
meshcli -s /dev/ttyACM0 -b 115200 ver
```
Open the port with the terminal start token sent automatically:
The automatic probe runs only at an empty prompt. A complete frame confirms
binary mode; an incomplete probe returns to ASCII after one second. Binary mode
then remains selected until reboot or the explicit terminal start token. See
[Full Companion USB CLI and binary switcher](./full_companion_usb_switcher.md)
for the byte-level state machine, logging and mOTA ownership, recovery paths,
and known limitations.
Immediately after boot, an ordinary terminal can issue ASCII commands without
a start token. If the device is already in Binary Companion mode, open the port
with the terminal start token sent automatically:
```bash
picocom -b 115200 \
--imap spchex \
--initstring '+++MESHCORE-TERM-START' \
--initstring $'+++MESHCORE-TERM-START\r' \
/dev/ttyACM0
```
@@ -310,8 +321,9 @@ logging off on a fresh installation.
### Single USB serial port
On an ESP32 Full Companion without dual CDC, interface `00` has two exclusive
modes. It starts as framed Binary Companion. Enter its text terminal with
`+++MESHCORE-TERM-START`, then run `set usb.logging on`; the same TTY emits
modes. It starts as the ASCII terminal unless a saved logging-on preference
boots directly into the logging terminal. If it is already binary, enter its
text terminal with `+++MESHCORE-TERM-START`, then run `set usb.logging on`; the same TTY emits
plaintext packet/debug logs and continues accepting CLI commands, including
`set usb.logging off`. Turning it off sends the command reply and then returns
that TTY to Binary Companion automatically, including on USB-UART bridges that
@@ -324,8 +336,9 @@ available while USB is logging.
Current nRF52 Full Companion and qualified native-USB ESP32-S3 Full Companion
firmware can expose two CDC ACM serial interfaces on one physical USB cable:
- USB interface `00` is the normal Binary Companion, text terminal, and serial
mOTA source port. It is always present.
- USB interface `00` is the primary Companion, text-terminal, and serial-mOTA
source port. It is always present, starts in ASCII after boot, and
automatically hands a complete `<` frame to Binary Companion.
- USB interface `02` is the optional write-only plaintext packet/debug logging
port. Host input on this interface is ignored and cannot invoke firmware
commands.
@@ -352,6 +365,14 @@ depending on a particular COM number. The nRF52 bootloader temporarily exposes
its normal DFU serial interface during an update. Qualified S3 boards
temporarily expose the ESP32-S3 ROM USB-JTAG serial port during a wired flash.
Opening the logging port prints `MeshCore USB logging port` followed by its
portable identity, `USB CDC 1; interface 02; Linux stable suffix: -if02`.
`get usb.logging` reports the same endpoint. Firmware cannot print the exact
`/dev/ttyACM*` or `COM*` name because Linux, macOS, or Windows assigns that name
after USB enumeration; use the `*-if02` link on Linux to obtain the exact path.
For example, `readlink -f /dev/serial/by-id/*-if02` prints the host-assigned
`/dev/ttyACM*` name.
Dual-CDC ESP32-S3 targets are Heltec V4, T-Beam 1W, Station G2/G3, XIAO S3
WIO, Heltec Tracker V2, Meshnology W12, and Nibble Screen/Zero Connect. The
base Heltec V4 profile has completed live two-interface, ROM-flashing, and
@@ -374,9 +395,14 @@ service at interface `02`.
ESP32 Full Companion exposes this same text terminal on TCP port 5002. Connect
with `nc DEVICE_IP 5002`; no USB control token is needed. USB terminal mode and
the TCP terminal share recipient, login, command, trace, and display state, so
only one may own the terminal at a time. Entering USB terminal mode closes an
active TCP terminal session. Disconnecting TCP clears pending terminal-only
state without cancelling Binary Companion delivery or radio retries.
only one may own the terminal at a time. The idle startup USB prompt yields to
a TCP connection when no USB data client or partial command is present, and is
restored when TCP disconnects. An active USB session rejects TCP; entering USB
terminal mode later closes an active TCP session. On USB-Serial-JTAG and
USB-to-UART hardware, the firmware cannot observe an idle host open, so actual
buffered USB activity—not the physical cable alone—claims ownership.
Disconnecting TCP clears pending terminal-only state without cancelling Binary
Companion delivery or radio retries.
Both terminal transports accept `reboot`. The reply is sent first and the
device reboots one second later, so a script can distinguish an accepted reboot
@@ -453,27 +479,35 @@ Return to Binary mode with:
+++MESHCORE-TERM-STOP
```
Closing the USB data connection also resets the port to Binary mode. A
different baud rate, including 57600, does not select ASCII mode.
Closing an armed ASCII USB data connection also changes the port to Binary
mode when the hardware can report disconnect. A USB-to-UART bridge may not be
able to report this event. A different baud rate, including 57600, does not
select ASCII mode.
On an ESP32 Full Companion built with `OTA_FOLDER_SERIAL`, `motatool` can keep
that terminal session open as an mOTA folder source when WiFi is unavailable:
the shared serial console open as an mOTA folder source when WiFi is
unavailable:
```sh
motatool serve --serial /dev/ttyACM0 --companion-terminal --dir ./motas -v
motatool serve --serial /dev/ttyACM0 --dir ./motas -v
```
The explicit flag is required because an ESP32 Companion starts the same USB
port in binary Companion mode. TCP port 5001 remains the preferred unattended
source transport.
The tool sends `ota folder on` through the text CLI, then uses the shared
serial mOTA framing. This is separate from the nRF52 exclusive USB ownership
mode described below. TCP port 5001 remains the preferred unattended source
transport.
## nRF52 USB mOTA mode
The nRF52 full target has a third, exclusive USB mode for the host folder.
Unmodified `motatool serve --serial` already sends `ota folder on` when it
opens the port. The Binary parser recognizes that exact idle control sequence,
stops USB Binary traffic, and attaches the serial folder source. The sequence
is not examined inside a framed Binary Companion packet.
Unmodified `motatool serve --serial` sends `ota folder on` when it opens the
port. The startup ASCII terminal recognizes that exact completed line, leaves
terminal mode, and gives the stream directly to exclusive mOTA handling. If
the port is already in Binary Companion mode, the idle binary parser recognizes
the same control sequence. The sequence is not examined inside a framed Binary
Companion packet. See the
[switcher guide](./full_companion_usb_switcher.md#logging-and-mota-ownership)
for the ownership transitions.
While mOTA mode owns USB:
@@ -483,7 +517,8 @@ While mOTA mode owns USB:
- `motatool` sending `ota folder off`, or disconnecting the USB data session,
detaches the folder and restores Binary mode.
No manual mode token or modified `motatool` build is required.
No modified `motatool` build, terminal token, or preliminary mode change is
required.
## nRF52 Bluetooth mOTA source
@@ -562,7 +597,7 @@ and close the terminal:
```bash
picocom -b 115200 \
--imap spchex \
--initstring '+++MESHCORE-TERM-START' \
--initstring $'+++MESHCORE-TERM-START\r' \
/dev/ttyACM1
```
+7 -4
View File
@@ -191,8 +191,10 @@ artifact is emitted. KISS, BLE-only Companion, and constrained LoRa-OTA
receiver images retain their protocol/partition contracts and do not inherit
plaintext USB logging.
Dual-CDC nRF52 and qualified native-USB ESP32-S3 builds keep Binary Companion
on interface `00`; `set usb.logging on reboot` adds plaintext interface `02`.
Dual-CDC nRF52 and qualified native-USB ESP32-S3 builds keep the multi-role
primary interface on `00`; it starts as an ASCII terminal and automatically
hands a complete `<` frame to Binary Companion. `set usb.logging on reboot`
adds plaintext interface `02`.
Single-TTY ESP32 builds instead use `set usb.logging on` to switch that TTY to
an input-capable plaintext logging terminal. `set usb.logging off` stops the
logs and returns the TTY to Binary Companion after its reply. BLE and Wi-Fi
@@ -246,6 +248,7 @@ For hardware with a dual-CDC Full Companion image, the picker recommends that
one normal image instead of separate USB, BLE, ordinary WiFi, and USB-logging
images. Full Companion provides the attached transports and a dedicated
plaintext logging port when enabled without mixing logs into framed Companion
traffic. Logging is off by default, so only the framed port appears until it is
enabled and the node reboots.
traffic. Logging is off by default, so only primary interface `00` appears; it
starts in ASCII and automatically changes to framed Companion when a complete
`<` frame arrives. Enabling logging and rebooting adds interface `02`.
Exact filename search still finds old aliases from earlier releases.
+251
View File
@@ -0,0 +1,251 @@
# Full Companion USB CLI and binary switcher
Full Companion uses one primary USB serial interface for two incompatible wire
formats:
- a human-readable ASCII command line;
- the framed Binary Companion protocol used by MeshCore apps and `meshcli`.
The primary interface starts in the ASCII terminal after each boot. A Binary
Companion client does not need to send a special mode command: its first valid
frame automatically hands the interface to the binary parser.
This automatic behavior is compiled only into `companion_radio_full` targets.
Ordinary USB Companion builds continue to use the explicit
`+++MESHCORE-TERM-START` and `+++MESHCORE-TERM-STOP` controls described in the
[Terminal Chat CLI guide](./terminal_chat_cli.md).
## Wire formats
Host-to-device Binary Companion frames use this layout:
```text
'<' length-low length-high payload[length]
```
Device-to-host frames use the same little-endian length with a different
marker:
```text
'>' length-low length-high payload[length]
```
For example, a representative two-byte device query is:
```text
3C 02 00 16 03
```
The ASCII terminal is line-oriented and accepts commands such as:
```text
get radio.cad
set display.rotation 90
reboot
```
Changing the configured baud rate does not select a mode. Use 115200 for
compatibility even though native USB CDC hardware does not use UART timing.
## State transitions
```text
complete '<' frame
+--------------------------------+
| v
boot ------> ASCII terminal Binary Companion
^ |
| | +++MESHCORE-TERM-START
| incomplete '<' probe |
| (one-second timeout) |
+--------------------------------+
ASCII terminal -- +++MESHCORE-TERM-STOP ------> Binary Companion
ASCII terminal -- observable USB disconnect ---> Binary Companion
any mode ------- reboot ------------------------> ASCII terminal
```
Serial mOTA and single-TTY logging add exclusive ownership states described
below. BLE, WiFi, Ethernet, and hardware-serial Companion transports are not
switched; they remain binary.
## How automatic detection works
1. Full Companion initializes the normal USB Binary Companion interface, then
gives its primary stream to the ASCII terminal before normal loop service
begins.
2. While the prompt has no buffered input, the terminal peeks at the next byte.
It does not remove that byte.
3. If the byte is `<`, the terminal temporarily releases the stream and enables
the existing `ArduinoSerialInterface` frame parser.
4. The parser consumes the original `<`, the two-byte length, and the payload.
There is no second parser and no copied or synthetic frame.
5. A monotonically increasing completed-frame counter confirms that the parser
received a complete frame. The interface then remains in Binary Companion
mode.
6. If no complete frame arrives within one second, the parser state is reset
and the ASCII terminal prints a new banner and prompt.
The switcher checks framing, not client identity. Any syntactically complete
Binary Companion frame confirms binary mode; it does not require the first
command to be `CMD_APP_START` or `CMD_DEVICE_QUERY`. Normal command validation
still occurs after the frame parser returns the payload.
The empty-prompt requirement prevents a literal `<` in the middle of a command
from silently changing modes. A literal `<` typed as the first character does
start a probe, but the terminal returns after the one-second timeout if no
binary header and payload follow.
## Manual controls
The original controls remain available.
From Binary Companion, send this exact unframed line while the parser is idle:
```text
+++MESHCORE-TERM-START
```
Terminate it with CR or LF. The binary parser accepts control tokens only as
complete delimiter-bounded lines; prefixes, suffixes, and partial tokens are
ignored.
From the ASCII terminal, send this exact sequence to return to binary mode:
```text
+++MESHCORE-TERM-STOP
```
The stop sequence takes effect as soon as its last byte arrives in ASCII mode.
The start sequence is recognized only as a completed line while the binary
parser is idle and is not examined inside a length-prefixed frame.
`meshcli` can normally connect directly after boot:
```bash
meshcli -s /dev/ttyACM0 -b 115200 ver
```
An explicit terminal start token is still useful when the device is already in
binary mode:
```bash
picocom -b 115200 \
--imap spchex \
--initstring $'+++MESHCORE-TERM-START\r' \
/dev/ttyACM0
```
## Logging and mOTA ownership
The switcher never attempts to mix ASCII, framed Companion traffic, or binary
mOTA traffic on the same stream.
| Situation | Primary USB behavior |
| --- | --- |
| Full Companion after boot | ASCII; a complete `<` frame switches to Binary Companion |
| Dual-CDC logging enabled | Primary interface still follows the switcher; logs use the optional second interface |
| Single-TTY logging enabled at boot | Logging terminal owns primary USB; automatic `<` detection is disabled |
| nRF52 USB serial mOTA active | mOTA owns primary USB; ASCII and Binary Companion are unavailable there |
| BLE/WiFi/Ethernet/hardware serial | Always Binary Companion and unaffected by the USB mode |
On a single-TTY build, use `set usb.logging off` in its logging terminal before
trying to use primary USB with an app. BLE and WiFi Companion transports remain
available while primary USB is logging.
On nRF52, serial `motatool` is also text-first. Its exact initial
`ota folder on` line is recognized in either startup ASCII or Binary Companion
mode. From ASCII, the firmware leaves terminal mode and directly enters
exclusive mOTA ownership; from binary, the idle frame parser recognizes the
same control sequence. The following mOTA request/reply frames therefore cannot
be consumed by the ASCII line editor. `motatool serve --serial` can be the
first client after boot and does not require a terminal token or disconnect
workaround.
Only the exact completed line selects mOTA from ASCII. Extra arguments,
leading/trailing whitespace, or a partial line remain ordinary terminal input.
## Shortcomings and edge cases
This mechanism is deliberately small and deterministic, but it is not a full
protocol negotiation layer.
### It is startup selection, not per-connection negotiation
After the first complete binary frame, the device stays in Binary Companion
mode. Closing `meshcli` does not automatically restore ASCII. Use the terminal
start token or reboot when an ASCII prompt is needed again.
Conversely, closing an ASCII terminal on native USB normally changes the port
to binary mode because the firmware can observe USB DTR/data disconnect. The
next client therefore sees binary mode, not a new ASCII session. A USB-to-UART
bridge often cannot report disconnect, so it can remain in ASCII until the stop
token or a reboot.
### Detection works only at an empty prompt
If part of an ASCII command is already buffered, an incoming `<` is treated as
ordinary terminal input. Clear or submit the line before starting a Binary
Companion client. Only one process should have the serial port open.
### The first frame has a one-second deadline
The complete marker, length, and payload must arrive within the probe window.
This is generous for local USB but may reject a heavily buffered serial proxy,
a debugger that pauses the MCU, or a tool that writes the header and body with
a long delay. A timed-out client can retry after the ASCII banner appears.
### Framing confirmation is not authentication
Any complete length-prefixed frame selects binary mode, even if its command is
unknown or malformed at the application layer. This is safe for stream
separation but means a random complete frame can leave the device in binary
mode until manually switched back.
### The terminal banner is best effort
The firmware enters ASCII mode during boot, often before a host opens the CDC
device. The banner may therefore be absent even though the terminal is ready;
send a newline or a harmless `get` command rather than treating a missing
banner as proof of binary mode.
A host that remains connected across a reboot may receive ASCII banner and
prompt bytes before the first binary response. Binary clients should discard
leading bytes until a plausible `>` frame marker and length are found, reject
implausible lengths, and resynchronize. The ordinary open-after-boot path has
been tested with `meshcli`, but third-party clients that assume byte zero is
always `>` may fail.
### Text and binary output cannot be interleaved
Primary USB suppresses Binary Companion output while the terminal owns the
stream. Packet/debug logging must use its dedicated CDC interface or the
exclusive single-TTY logging mode. Writing diagnostic text directly to the
primary binary stream will corrupt clients regardless of the switcher.
### A literal leading `<` briefly hides the prompt
Typing `<` as the first terminal character begins a binary probe. With no
complete frame, the prompt returns after one second and the banner is printed
again. There is currently no escape syntax for entering a literal leading `<`;
prefix it with another character if it is needed as command text.
## Troubleshooting
If `meshcli` cannot connect:
1. close every terminal or logging reader using the primary interface;
2. confirm that saved single-TTY logging is off;
3. reboot and let `meshcli` be the first process to open the data interface;
4. use the stable `/dev/serial/by-id/*-if00` path on Linux when available;
5. if a prompt appears after one second, the client's first frame was not
completed inside the probe window.
If an ASCII terminal shows no banner, press Enter and issue a harmless query
such as `get radio.cad`. If binary bytes appear, send the exact terminal start
token or reboot.
The switch policy is implemented in
[`UsbAsciiBinarySwitch.h`](../src/helpers/UsbAsciiBinarySwitch.h), with stream
ownership in [`main.cpp`](../examples/companion_radio/main.cpp) and framing in
[`ArduinoSerialInterface.cpp`](../src/helpers/ArduinoSerialInterface.cpp).
+1
View File
@@ -20,6 +20,7 @@ Below are a few quick start guides.
- [Companion Protocol](./companion_protocol.md)
- [Companion Offline Message Queue](./companion_offline_queue.md)
- [Full Companion: ESP32 and nRF52](./companion_radio_full.md)
- [Full Companion USB CLI and binary switcher](./full_companion_usb_switcher.md)
- [Packet Format](./packet_format.md)
- [QR Codes](./qr_codes.md)
+20 -11
View File
@@ -53,16 +53,18 @@ reopening the controller while `motatool` owns the source port. The script
rejects an attempt to use the same port for both.
The USB ASCII switch (`+++MESHCORE-TERM-START`) is the local control path, not
the mOTA data framing. On a dual-CDC full Companion, the script uses that mode
briefly for `ota status` and TempRadio commands. It then closes the CLI and
starts `motatool`, whose existing `ota folder on` preamble switches the same
USB interface `00` into exclusive mOTA mode. If USB logging was enabled and the
Full Companion rebooted, its separate interface `02` continues to provide
plaintext logging and is not a controller or source port. With default logging
off, interface `02` is not enumerated.
On a native-USB ESP32-S3 Full Companion with serial folder support,
`motatool --companion-terminal` keeps the ASCII session open
while the same link carries framed folder requests. BLE remains available.
the mOTA data framing. On an nRF52 dual-CDC Full Companion, the script uses
that mode briefly for `ota status` and TempRadio commands. It then closes the
CLI and starts `motatool`; the exact `ota folder on` preamble switches the same
USB interface `00` into exclusive mOTA mode from either startup ASCII or
Binary Companion mode. If USB logging was enabled and the Full Companion
rebooted, its separate interface `02` continues to provide plaintext logging
and is not a controller or source port. With default logging off, interface
`02` is not enumerated. BLE remains available.
ESP32 Full Companion normally uses its dedicated TCP seeder on port 5001.
ESP32 builds that also retain serial folder support use the shared-console
mOTA framing rather than the nRF52 exclusive USB ownership state.
## Destination requirements
@@ -157,7 +159,7 @@ automatically:
```bash
picocom -b 115200 \
--imap spchex \
--initstring '+++MESHCORE-TERM-START' \
--initstring $'+++MESHCORE-TERM-START\r' \
/dev/ttyACM1
```
@@ -409,6 +411,13 @@ An nRF52 `companion_radio_full` uses one USB source port sequentially. The
runner automatically wraps local control commands in the terminal tokens, and
unmodified `motatool` switches that port into mOTA mode when seeding starts:
The wrapper sends STOP, then START, before each command. This makes fallback
independent of whether a prior raw probe left an unobservable USB-UART
connection in ASCII or Binary mode. Seeder startup is reported only after the
verbose device log contains its `COUNT` acknowledgement; an immediate device
`ERR` or a missing acknowledgement fails during startup instead of surfacing
later as a catalog timeout.
```bash
./tools/lora_ota/lora_ota.sh ./release.mota "Remote Target" \
--controller-serial /dev/ttyACM0 \
+9 -5
View File
@@ -152,11 +152,15 @@ If an older build reports that `OTA_FOLDER_SERIAL` is not compiled in, install a
`-full-usb-wifi-ota-`, or applicable `-full-logging-ota-` build first. Do **not** use a KISS modem: KISS firmware is a TNC/KISS frame interface
and does not provide the MeshCore CLI or the OTA-folder transport that `motatool serve` requires.
An nRF52 `companion_radio_full` starts in USB Binary mode. Use
`+++MESHCORE-TERM-START` for local TempRadio commands, then return with
`+++MESHCORE-TERM-STOP`. When `motatool serve --serial` opens the port, its
automatic `ota folder on` command selects exclusive mOTA mode; stopping the
tool or disconnecting resets USB to Binary. BLE remains available throughout.
An nRF52 `companion_radio_full` starts in its USB ASCII terminal and
automatically changes to Binary Companion when it receives a complete `<`
frame. It also recognizes `motatool`'s exact initial `ota folder on` line and
enters exclusive mOTA mode directly, so `motatool serve --serial` can be the
first client after boot. No terminal token or preliminary disconnect is
required. Stopping the tool or disconnecting resets USB to Binary. BLE remains
available throughout. See the
[Full Companion USB switcher guide](./full_companion_usb_switcher.md#logging-and-mota-ownership)
for the complete ownership transitions.
Protocol v14 can instead take the catalog from a paired phone or Linux host
over a separate encrypted BLE mOTA service while Binary Companion remains
active. USB and BLE catalog sources are mutually exclusive. See the
+7 -7
View File
@@ -226,22 +226,22 @@ relays are all v1.17.1.5 or newer, use the generic LoRa OTA runner; it can
retain RXPS at the qualified level-8/preamble-64 boundary for SF5/BW250 or the
level-8/preamble-128 boundary for SF5/BW500.
Put the source on the identical TempRadio tuple. If it is a binary-mode Full
Companion, the current `motatool` can switch modes for the serving session:
Put the source on the identical TempRadio tuple. A current ASCII-first Full
Companion recognizes `motatool`'s initial `ota folder on` line directly:
```bash
motatool serve \
--dir ./motas \
--serial /dev/ttyACM1 \
--baud 115200 \
--companion-terminal \
-v
```
Omit `--companion-terminal` for an ordinary text-console OTA source. Restart
`motatool` for every step so the source emits a fresh catalog advert. Leave it
running during the download and stop it with Ctrl-C only after the destination
reports `ready to install`.
The same command also works with older Full Companion firmware in binary mode,
where the idle parser recognizes the identical preamble. Restart `motatool` for
every step so the source emits a fresh catalog advert. Leave it running during
the download and stop it with Ctrl-C only after the destination reports `ready
to install`.
### 3. Install all nine packages in order
+14 -4
View File
@@ -4,23 +4,27 @@ Below are the commands you can enter into the Terminal Chat clients:
## Companion USB mode
A Companion USB build starts in the normal binary Companion protocol at
115200 baud. Use this command to switch the same USB connection into terminal
An ordinary Companion USB build starts in the normal binary Companion protocol
at 115200 baud. Use this command to switch the same USB connection into terminal
mode as soon as `picocom` opens it:
```sh
picocom --baud 115200 \
--imap spchex \
--initstring '+++MESHCORE-TERM-START' \
--initstring $'+++MESHCORE-TERM-START\r' \
/dev/ttyACM0
```
`--initstring` sends this exact terminal-start sequence automatically:
`--initstring` sends this exact terminal-start line automatically:
```
+++MESHCORE-TERM-START
```
The carriage return is required in Binary mode. Control tokens are recognized
only as complete CR/LF-delimited lines, so the same text embedded in unrelated
unframed input cannot switch modes accidentally.
Binary Companion frames can contain terminal control bytes. The `spchex` input
map renders those bytes as bracketed hexadecimal during the short transition
instead of allowing them to change the local terminal's character set or
@@ -47,6 +51,12 @@ devices really change the UART timing and receive corrupt data. Binary mode is
the framed Companion API used by apps and `meshcli`; close the terminal before
opening that port from an app.
Full Companion differs: its primary USB interface starts in ASCII after boot
and automatically switches when it sees a complete `<`-prefixed Companion
frame at an empty prompt. The explicit start/stop tokens remain available. See
[Full Companion USB CLI and binary switcher](./full_companion_usb_switcher.md)
for the state machine and limitations.
## Commands
```