Skip to content

USB companion radio firmware on Heltec V4.3: when the name has length 6, APP_START requests stall #3894

Open

Description

@miyuki

I am using a Heltec V4.3 OLED board with Companion radio USB v1.18.0-81dbae5 (14) firmware (heltec_v4_companion_radio_usb) and meshcli v1.6.10 on Ubuntu 26.04.

When the name has length of 6 characters, requesting "infos" via USB takes up to ~20 seconds instead of the usual milliseconds with other name lengths.

Reproducer script:

#!/bin/bash

PORT=${1:-/dev/ttyACM0}

for name in abcdef abcdefg; do
  echo
  echo "=== name '$name'"
  uv run meshcli -s "$PORT" set name "$name"
  sleep 5
  for i in 1 2 3; do
    echo "run $i:"
    time uv run meshcli -s "$PORT" infos >/dev/null
    sleep 1
  done
done

Output:

=== name 'abcdef'
INFO:meshcore:Serial Connection started
INFO:meshcore:Connected to abcdefg running on a v1.18.0-81dbae5 (14) fw.
ok
run 1:
INFO:meshcore:Serial Connection started
INFO:meshcore:No response from meshcore node, trying to force DTR = True
INFO:meshcore:Serial Connection started
INFO:meshcore:Connected to abcdef running on a v1.18.0-81dbae5 (14) fw.

real    0m18.138s
user    0m0.099s
sys     0m0.021s
run 2:
INFO:meshcore:Serial Connection started
INFO:meshcore:No response from meshcore node, trying to force DTR = True
INFO:meshcore:Serial Connection started
INFO:meshcore:Connected to abcdef running on a v1.18.0-81dbae5 (14) fw.

real    0m7.542s
user    0m0.104s
sys     0m0.019s
run 3:
INFO:meshcore:Serial Connection started
INFO:meshcore:No response from meshcore node, trying to force DTR = True
INFO:meshcore:Serial Connection started
INFO:meshcore:No response from meshcore node, trying to invert dtr (now False)
INFO:meshcore:Serial Connection started
ERROR:meshcore:No response from meshcore node, disconnecting
ERROR:meshcore:Are you sure your node is a serial companion ?
ERROR:meshcore:To connect to a repeater, use -r option.

real    0m8.127s
user    0m0.084s
sys     0m0.030s

=== name 'abcdefg'
INFO:meshcore:Serial Connection started
INFO:meshcore:No response from meshcore node, trying to force DTR = True
INFO:meshcore:Serial Connection started
INFO:meshcore:Connected to abcdef running on a v1.18.0-81dbae5 (14) fw.
ok
run 1:
INFO:meshcore:Serial Connection started
INFO:meshcore:Connected to abcdefg running on a v1.18.0-81dbae5 (14) fw.

real    0m0.116s
user    0m0.095s
sys     0m0.019s
run 2:
INFO:meshcore:Serial Connection started
INFO:meshcore:Connected to abcdefg running on a v1.18.0-81dbae5 (14) fw.

real    0m0.115s
user    0m0.094s
sys     0m0.018s
run 3:
INFO:meshcore:Serial Connection started
INFO:meshcore:Connected to abcdefg running on a v1.18.0-81dbae5 (14) fw.

real    0m0.115s
user    0m0.089s
sys     0m0.023s

Note now with name length 7, the infos command takes about 100 ms (as expected), but with length 6 it can take up to ~20 s. This causes timeouts when trying to use this MeshCore device with Home Assistant (i.e. Home Assistant fails to connect to the device due to these timeouts).

An investigation performed by an AI agent suggests that this issue happens because when the name has length 6, the APP_START reply SELF_INFO payload has size 64 bytes, and the USB interface treats it as if the host is about to send more data (i.e. it waits and does not transmit it over USB).
A fork of MeshCore called Offband seems to had faced a similar issue and fixed it downstream: OffbandMesh/meshcore-firmware#1037, OffbandMesh/meshcore-firmware#1093.

Possibly related: MeshCore #3751 (ESP32-S3 HWCDC TX race on core 2.0.17, fixed by arduino-esp32 #12606 in core 3.3.9). That PR also has the ISR send a terminating ZLP once the TX ring is empty, so moving to core 3.3.9 or later may fix this too. Not tested.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions