Repository navigation
Conversation
On a Shimmer3, channel IDs 0x14-0x16 (the MPU9x50/ICM-20948 accel, big-endian) and 0x17-0x19 (its AK8975/AK8963/AK09916, little-endian) take 2 bytes each, as shimmer3-firmware's I2C_configureChannels packs them. interpretDataPacketFormat gave them bytes only on a Shimmer3R, so a Shimmer3 stream with either sensor on was 6 bytes short per sensor and mis-framed from the first packet; and buildMsg's alt blocks, which updateEnabledSensorsFromChannels turns on for a Shimmer3 too, looked up the Shimmer3R names (index -1) and calibrated with null details. - interpretDataPacketFormat: on a Shimmer3, Accel_MPU_X/Y/Z as i16r and Mag_MPU_X/Y/Z as i16, the names and types a Shimmer3 SD file already gives them. - buildMsg: the ADXL371 and LIS3MDL blocks run on a Shimmer3R only; a Shimmer3's two sensors are decoded uncalibrated wherever the channel list puts them, from Bluetooth or an SD file. The driver holds no Shimmer3 calibration for them. API_00042: 9 tests on packets laid out as the firmware packs them on an ICM-20948 board, where each alt sensor repeats a wide-range channel's reading in the other byte order. On the unpatched driver 8 fail (packet 29 bytes, not 41; index -1 in the high-g block); the Shimmer3R case passes on both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master gained API_00042_EventRecordFileTest (DEV-971) after this branch was cut, and its tests now run to API_00048. No test code changed. Co-Authored-By: Claude Fable 5.2 <[email protected]>
JongChern
approved these changes
Nov 17, 2026
JongChern
left a comment
Contributor
There was a problem hiding this comment.
Approved. I reviewed the change against master and pushed one small commit to this branch, 7077d6d3.
What I changed: the test is renamed from API_00042_Shimmer3AltAccelMagChannelsTest to API_00049_Shimmer3AltAccelMagChannelsTest. No test code changed.
Why: master gained API_00042_EventRecordFileTest after this branch was cut, and its tests now run to API_00048. Two tests with one number would make the numbers useless for finding a test.
What I checked:
- Merged with today's master: ShimmerDriver 228 of 228.
- The new test against master's driver without the fix: 8 of 9 fail, as the description says.
- On this branch after the rename: ShimmerDriver 187 of 187.
- The orientation step does not count these sensors on a Shimmer3, so the uncalibrated values cannot feed it.
Still open, not blocking: ShimmerAndroidAPI gets this only after a driver release and a pin bump. Nothing here ran on a unit beyond the bench check in the description.
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.
DEV-1451. A Shimmer3 stream with the alternative accelerometer (channel IDs
0x14-0x16) or the alternative magnetometer (0x17-0x19) on was mis-sized: those IDs took no bytes on a Shimmer3.The defect
interpretDataPacketFormatgave0x14-0x19a name, a type and 2 bytes only on a Shimmer3R. On a Shimmer3 the expected packet was 6 bytes short per sensor, so the stream was mis-framed from the first packet.buildMsgwould fail next:updateEnabledSensorsFromChannelssetsSENSOR_ALT_ACCEL/SENSOR_ALT_MAGthere;getCurrentCalibDetailsAccelAlt()/getCurrentCalibDetailsMagAlt(), which are null on a Shimmer3.buildMsgblocks, so it is affected the same way.What the firmware sends
shimmer3-firmware
LogAndStream_Shimmer3/i2c.c,I2C_configureChannels, and log-and-stream-commondocs/SHIMMER3_STREAMING_DATA_FORMAT.md§4.1 rows 14-15 and §5.2:0x14-0x16ACCEL_XOUT_H0x17-0x19HXLThe firmware's HIL rig streamed a Shimmer3 with both on (ICM-20948 board, v1.01.009): 1016 packets, 21 channels each.
The fix
interpretDataPacketFormat: on a Shimmer3,Accel_MPU_X/Y/Ztypedi16r, andMag_MPU_X/Y/Ztypedi16. These are the names and types a Shimmer3 SD file already gives them.buildMsg:Tests
API_00042_Shimmer3AltAccelMagChannelsTest, 9 tests, no hardware. The packets are laid out as the firmware packs them on an ICM-20948 board. There the alternative accel is the same chip reading as the wide-range accel, in the other byte order with Y negated, and the alternative mag the same reading as the mag. So each pair checks the other's byte order. The tests cover:Results:
ArrayIndexOutOfBoundsException: Index -1in the high-g block). The Shimmer3R case passes on both.Where else this applies
ShimmerAndroidAPIsizes packets with this method, so it gets the fix only after a driver republish and a pin bump.Bench check, 16 Nov 2026
Two Shimmer3s on LogAndStream v1.01.009, both boards where the ICM-20948 stands in for the LSM303 (SR49-3-1 and SR31-9-1, RN4678 radios). On these boards the firmware fills the wide-range accel and the mag from the same ICM-20948 reading the alternative accel and mag carry, in the other byte order, so every sample can be checked exactly.
interpretInqResponse) and each packet throughbuildMsg, as Accel_MPU and Mag_MPU, with no framing errors. Every raw value matched that layout, on every channel it decodes, in all 503 packets from each unit.Not covered
🤖 Generated with Claude Code