Skip to content

Fix INA226 detection for non-TI compatible chip (Silergy)#10247

Merged
fifieldt merged 6 commits into
meshtastic:developfrom
theKorzh:fix-ina226-detection
Apr 24, 2026
Merged

Fix INA226 detection for non-TI compatible chip (Silergy)#10247
fifieldt merged 6 commits into
meshtastic:developfrom
theKorzh:fix-ina226-detection

Conversation

@theKorzh

@theKorzh theKorzh commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Fix incorrect SHTXX detection for INA226-compatible sensor Silergy SQ52201

Problem

Popular cheap INA226-compatible current/power monitor chip Silergy SQ52201 is incorrectly detected as SHTXX (SHT2X).
(These chips are commonly found on modules sold as “INA226” or even misrepresented as TI parts, so users may be unaware they are using Silergy silicon instead of Texas Instruments).

This happens due to strict Manufacturer ID check (only TI 0x5449 accepted)


Root cause

INA2xx-compatible chips do not always use TI's Manufacturer ID:

Device MFG ID DIE ID
INA226 (TI) 0x5449 0x2260
SQ52201 (Silergy) 0x190F 0x0000

Current logic only accepts 0x5449, causing valid compatible devices to fall through to SHT detection.


Changes

  • Extended INA detection to support known compatible MFG IDs

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other: Heltec VisionMaster E213

@github-actions github-actions Bot added the bugfix Pull request that fixes bugs label Apr 22, 2026
@theKorzh

Copy link
Copy Markdown
Contributor Author

Closing this PR for now.

It appears that the Silergy SQ52201 is not fully compatible with INA226.

I will revisit logic.

@theKorzh theKorzh closed this Apr 22, 2026
@theKorzh

Copy link
Copy Markdown
Contributor Author

Reopening this PR — closed it by mistake.

During additional testing of the SQ52201 support and compatiblity, I accidentally used a defective module unit, which produced incorrect readings and made it look like the changes were broken. The code itself is ready for review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the I2C auto-detection logic to correctly recognize an INA226-compatible Silergy SQ52201 current/power monitor (which shares the 0x40 address with SHT2x sensors), preventing it from being misdetected as an SHT2x device.

Changes:

  • Adds explicit MFG/DIE ID matching for Silergy SQ52201 to be treated as INA226.
  • Refines INA226 vs INA260 identification using both MFG and DIE IDs (for TI INA226) and MFG-only fallback (for TI INA260).
  • Keeps the SHT2x serial-number probe as a fallback when INA IDs don’t match.

Comment thread src/detect/ScanI2CTwoWire.cpp Outdated

@fifieldt fifieldt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed work!

@fifieldt fifieldt merged commit ba9cadc into meshtastic:develop Apr 24, 2026
78 checks passed
@theKorzh theKorzh deleted the fix-ina226-detection branch April 24, 2026 07:20
mariotti pushed a commit to mariotti/firmware that referenced this pull request May 6, 2026
…#10247)

* Fix INA226 detection for non-TI compatible chip (Silergy)

* Removed extra I2C transaction + 20ms delay on every scan of address 0x40 (including real SHT2x sensors).

Changes suggested by Copilot

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Apply formatting (trunk fmt)

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants