Skip to content

update to fix uart comms issues in cc1200 modem control - WIP, don't merge yet. #2

Closed
JKI757 wants to merge 2 commits into
jancona:masterfrom
JKI757:jki757/cc1200-hat-fix
Closed

update to fix uart comms issues in cc1200 modem control - WIP, don't merge yet. #2
JKI757 wants to merge 2 commits into
jancona:masterfrom
JKI757:jki757/cc1200-hat-fix

Conversation

@JKI757

@JKI757 JKI757 commented Oct 4, 2025

Copy link
Copy Markdown

this PR makes two fixes:

problem 1:

  • commandWithResponse marks isCommandWithResponse = true before sending a
    command so that the UART reader goroutine diverts incoming bytes into the
    cmdSource channel.
  • If m.command(cmd) returns an error (e.g., serial write failure, timeout, or
    modem reset), the function returns without clearing isCommandWithResponse.
  • The reader keeps routing every subsequent byte into cmdSource, while no
    goroutine reads from it any more. The buffered channel fills, processReceivedData
    blocks, and symbol traffic stops, making the gateway appear frozen.

fix:

  • Added routeIncomingByte, a helper that centralises routing of incoming
    bytes either to the command-response channel or the RX pipeline without
    holding the mutex while sending.
  • Hardened commandWithResponse with a defer that always clears the
    isCommandWithResponse flag and drains any stale bytes regardless of how the
    function exits.
  • Retained the clearResponseBuf call before issuing a command so unexpected
    bytes from previous transactions cannot poison the next response.

problem 2:

  • processReceivedData terminates if a single Read call returns an error. once this goroutine
    exits, no one services the UART so the modem is unresponsive.

fix:

  • Keep the goroutine running on transient read failures by logging the error
    and retrying instead of breaking out of the loop.
  • Treat io.EOF as a recoverable event with a short back-off.
  • Use the new routeIncomingByte helper to fan bytes out safely and log when
    the RX pipeline is saturated.

@JKI757 JKI757 changed the title update to fix uart comms issues in cc1200 modem control update to fix uart comms issues in cc1200 modem control - WIP, don't merge yet. Oct 4, 2025
@sp5wwp

sp5wwp commented Dec 7, 2025

Copy link
Copy Markdown

Are any of those issues fixed already?

@jancona

jancona commented Dec 7, 2025

Copy link
Copy Markdown
Owner

These changes did not resolve the comms issues. With the new firmware protocol, they're now obsolete, so I'm closing this PR.

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