fix(ads1258): correct CONFIG1 SCBCS field values for bits [3:2]#3
Open
scalecode-solutions wants to merge 1 commit intoTexasInstruments:mainfrom
Open
Conversation
CONFIG1_SCBCS_1_5uA and CONFIG1_SCBCS_24uA were set to 0x40 and 0xC0, which place the values in the DLY/IDLMOD bit positions (bits [7:6]) instead of the SCBCS field (bits [3:2]). The header's own mask confirms the correct position: CONFIG1_SCBCS_MASK = 0x0C (bits [3:2]) The previous values fail their own mask: 0x40 & 0x0C = 0x00 (no bits in SCBCS field) 0xC0 & 0x0C = 0x00 (no bits in SCBCS field) Corrected per ADS1258 datasheet SBAS297G, Table 18, page 38: SBCS[1:0] = 0 (0x00) → Off SBCS[1:0] = 1 (0x04) → 1.5µA Source SBCS[1:0] = 3 (0x0C) → 24µA Source Note: 0x40 collides with CONFIG1_DLY_64us defined on line 196 of the same file, meaning any code using CONFIG1_SCBCS_1_5uA would silently configure a 64µs switch time delay instead of enabling sensor bias.
There was a problem hiding this comment.
Pull request overview
Corrects the ADS1258 CONFIG1 sensor-bias current source (SCBCS) field value macros so they map to bits [3:2] (matching CONFIG1_SCBCS_MASK) instead of incorrectly targeting bits [7:6] (IDLMOD/DLY region).
Changes:
- Fix
CONFIG1_SCBCS_1_5uAto0x04(SCBCS =01bat bits[3:2]). - Fix
CONFIG1_SCBCS_24uAto0x0C(SCBCS =11bat bits[3:2]).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
CONFIG1_SCBCS_1_5uAandCONFIG1_SCBCS_24uAinads1258.hhave incorrect values. The field values target bits [7:6] (IDLMOD/DLY positions) instead of bits [3:2] (SCBCS positions).The Bug
The values fail their own mask —
0x40 & 0x0C = 0x00and0xC0 & 0x0C = 0x00.Additionally,
0x40collides withCONFIG1_DLY_64usdefined on line 196, so code usingCONFIG1_SCBCS_1_5uAwould silently configure a 64µs switch time delay instead of the sensor bias current source.The Fix
Datasheet Reference
ADS1258 datasheet SBAS297G, Table 18 (page 38):
Root Cause
The logical encoding values (1 and 3) are correct, but they were shifted to bits [7:6] instead of bits [3:2] — left-shifted by 6 instead of by 2.
0x000x000x040x400x0C0xC0Impact
Low in practice —
adcStartupRoutine()does not use these constants, so the bug is dormant in the example code. It only affects users who explicitly configure sensor bias current using the named constants.Additional Note
The datasheet uses SBCS (Sensor Bias Current Source) while the header uses SCBCS. This is a minor naming discrepancy but not addressed in this PR to avoid unnecessary breakage.