samples: ncp: wait for the host before starting the stack - #133
Merged
Merged
Conversation
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>
kkasperczyk-no
approved these changes
Aug 4, 2026
ArekBalysNordic
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.