Fix INA226 detection for non-TI compatible chip (Silergy)#10247
Open
theKorzh wants to merge 1 commit intomeshtastic:developfrom
Open
Fix INA226 detection for non-TI compatible chip (Silergy)#10247theKorzh wants to merge 1 commit intomeshtastic:developfrom
theKorzh wants to merge 1 commit intomeshtastic:developfrom
Conversation
Author
|
Closing this PR for now. It appears that the Silergy SQ52201 is not fully compatible with INA226. I will revisit logic. |
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. |
Contributor
There was a problem hiding this comment.
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 on lines
+420
to
+424
| uint16_t mfg = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFE), 2); | ||
| uint16_t die = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFF), 2); | ||
|
|
||
| if (registerValue == 0x2260) { | ||
| logFoundDevice("INA226", (uint8_t)addr.address); | ||
| type = INA226; | ||
| } else { | ||
| logFoundDevice("INA260", (uint8_t)addr.address); | ||
| type = INA260; | ||
| } | ||
| LOG_DEBUG("Register MFG_UID: 0x%x", mfg); | ||
| LOG_DEBUG("Register DIE_UID: 0x%x", die); |
fifieldt
approved these changes
Apr 22, 2026
Member
fifieldt
left a comment
There was a problem hiding this comment.
Thanks for the detailed work!
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.
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
0x5449accepted)Root cause
INA2xx-compatible chips do not always use TI's Manufacturer ID:
Current logic only accepts
0x5449, causing valid compatible devices to fall through to SHT detection.Changes
🤝 Attestations