update to fix uart comms issues in cc1200 modem control - WIP, don't merge yet. #2
Closed
JKI757 wants to merge 2 commits into
Closed
update to fix uart comms issues in cc1200 modem control - WIP, don't merge yet. #2JKI757 wants to merge 2 commits into
JKI757 wants to merge 2 commits into
Conversation
|
Are any of those issues fixed already? |
Owner
|
These changes did not resolve the comms issues. With the new firmware protocol, they're now obsolete, so I'm closing this PR. |
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.
this PR makes two fixes:
problem 1:
commandWithResponsemarksisCommandWithResponse = truebefore sending acommand so that the UART reader goroutine diverts incoming bytes into the
cmdSourcechannel.m.command(cmd)returns an error (e.g., serial write failure, timeout, ormodem reset), the function returns without clearing
isCommandWithResponse.cmdSource, while nogoroutine reads from it any more. The buffered channel fills,
processReceivedDatablocks, and symbol traffic stops, making the gateway appear frozen.
fix:
routeIncomingByte, a helper that centralises routing of incomingbytes either to the command-response channel or the RX pipeline without
holding the mutex while sending.
commandWithResponsewith adeferthat always clears theisCommandWithResponseflag and drains any stale bytes regardless of how thefunction exits.
clearResponseBufcall before issuing a command so unexpectedbytes from previous transactions cannot poison the next response.
problem 2:
processReceivedDataterminates if a singleReadcall returns an error. once this goroutineexits, no one services the UART so the modem is unresponsive.
fix:
and retrying instead of breaking out of the loop.
io.EOFas a recoverable event with a short back-off.routeIncomingBytehelper to fan bytes out safely and log whenthe RX pipeline is saturated.