← Back to Pull requests

fix(PeriphDrivers): Fix STOP and repeated START handling in I2C RevA #1640

Closed
unknown closed this pull request without merging on Nov 06, 2026 06:47 UTC
View on GitHub
unknown unknown commented on Oct 26, 2026 01:24 UTC
Author

Description

A blocking I2C RevA transaction returns while its STOP is still on the bus, because MSTCTRL.STOP clears when the STOP starts, not when it ends. The STATUS.BUSY check added in #1359 then rejects the next transaction with E_BUSY, so even two blocking reads back-to-back fail. A transaction that ends in a repeated START (restart = 1) leaves STATUS.BUSY set: the next blocking call returns E_BUSY, and the next async call waits forever in the busy check added in #1416.

  • MXC_I2C_RevA_Stop() now waits for STATUS.BUSY to clear. The blocking transaction, the async interrupt handler, and the DMA callback all end through it, so the STOP has finished before the call returns or the callback returns.

  • The busy checks in MXC_I2C_RevA_MasterTransaction() and MXC_I2C_RevA_MasterTransactionASync() ignore STATUS.BUSY when STATUS.MST_BUSY is also set, which means this controller still holds the bus after its own repeated START.

  • After a repeated START, read-only blocking and DMA transactions, and all async transactions no longer call MXC_I2C_Start(). The repeated START is already on the bus, and requesting another one put an empty Sr-Sr on the bus.

  • MXC_I2C_RevA_MasterTransactionAsync() sets RXCTRL1 before loading the read address, because after a repeated START the controller sends the address as soon as it is in the FIFO.
  • Checklist Before Requesting Review

  • PR Title follows correct guidelines.

  • Description of changes and all other relevant information.

  • (Optional) Link any related GitHub issues using a keyword

  • (Optional) Provide info on any relevant functional testing/validation. For API changes or significant features, this is not optional.
  • Testing

    Testing was done on a MAX32655FTHR and a MAX32690EVKIT. The test suite runs 14 test cases of 1000 transactions each back-to-back. The test suite was run against v2023_06, v2023_10, v2024_02, v2024_10, main, and local copies of the Maxim SDK supplied with CFS 2.1.0 and CFS 2.3.0. More details can be found here:

  • MAX32655FTHR

  • MAX32690EVKIT
  • The code for testing can be found here:

  • MAX32655FTHR

  • MAX32690EVKIT
  • Results can be found here:

  • MAX32655FTHR

  • MAX32690EVKIT
  • Diff: 388 lines (+291 / -97) across 4 files Reviewer: ttmut Review duration: 16162m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.43) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 388 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.357
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1640"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.1% (MEDIUM) · Higher = larger blast radius
    43.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.6% · Safe to merge
    18.6%