Skip to content

samples: ncp: wait for the host before starting the stack - #133

Merged
edmont merged 2 commits into
nrfconnect:mainfrom
edmont:pr/dongle-ncp
Aug 4, 2026
Merged

edmont merged 2 commits into
nrfconnect:mainfrom
edmont:pr/dongle-ncp

Conversation

@edmont

@edmont edmont commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

edmont added 2 commits August 4, 2026 13:59
The R22 sample held main() until the host raised DTR on the CDC ACM port and
only then let the stack run. R23 dropped that wait but kept the Kconfig that
used to drive it, CONFIG_ZIGBEE_UART_SUPPORTS_FLOW_CONTROL, which the nRF52840
Dongle still enables through CONFIG_UART_LINE_CTRL with a comment saying the
transport needs it "to observe DTR on the CDC ACM port". Nothing observed it any
more, and the symbol had no reader left in any source.

So the stack came up whether or not anything was listening, and the sample's own
custom indication alarm, armed for three seconds after boot, fired into a port
that on the dongle the host is still busy reopening: it re-enumerates about nine
seconds after a reset, and the NCP then disappears roughly 2.6 s later, which is
when this indication is due. The nRF52840 DK never showed it because MCUboot's
12 s USB DFU wait leaves the host reconnected long beforehand.

Wait for DTR again, report DCD and DSR once it arrives, and give the host a
moment to finish configuring the port. On a DK forced into the dongle's
configuration the device now stays quiet until the port is opened:

   0.003  cdc      present at start
  20.003  host     opening ...Zigbee_NCP_C84736B931F8B265-if00
  21.230  device   I: Zigbee R23 Network Co-processor sample started
  22.207  host     rx dead0c0006c07c464400022b0005
  24.410  host     rx dead0c0006c48437600002020a01

Builds without flow control, the DK over USB and the UART co-processor, keep
starting immediately and do not link the line control calls at all.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
The sample only waits for the host when ZIGBEE_UART_SUPPORTS_FLOW_CONTROL is set,
and that symbol depends on UART_LINE_CTRL, which the boards turn on for their shell
builds alone. Both USB configurations asked for the former without the latter, so
the wait was silently compiled out everywhere except the dongle.

Without it the stack answers a host requested reset while the port is still gone:
the device re-enumerates around a second before the host can reopen it, and the
reset response is dropped, leaving the host waiting for a reply that never comes.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
@edmont
edmont requested a review from a team as a code owner August 4, 2026 12:59
@edmont
edmont merged commit 456c763 into nrfconnect:main Aug 4, 2026
6 checks passed
@edmont
edmont deleted the pr/dongle-ncp branch August 4, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants