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

Aperta
#3,894 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
arduino, c, cpp
Ambito
embedded-iot

Direzione di ricerca

Start by reproducing with the reporter's shell script against a Heltec V4.3 running the companion USB firmware, using meshcli to set a six-character name and then time the infos command. The reporter links a 64-byte SELF_INFO reply for APP_START to the USB serial layer, so the serial transmit path is the place to look. Done means infos responds in milliseconds for a six-character name as it does for seven, and the fix is confirmed on hardware.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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: https://github.com/OffbandMesh/meshcore-firmware/issues/1037, https://github.com/OffbandMesh/meshcore-firmware/issues/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.

Lingua principale
C
Stelle
3.9k
Fork
1.5k
Merge medio
2g 19h
PR unite (30g)
61

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di meshcore-dev/MeshCore

Tutte le issue di meshcore-dev/MeshCore

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.