Commit aa61da1
DEV-958: correct the rationale - 0.061 mg/LSB is real, not a rounding
My previous comment claimed ST's accel figures were just 32768/FS rounded to
three significant figures, and that the old derived values were therefore the
more accurate of the two. That was wrong, and the datasheet settles it.
AN5922 Table 27 (FS_XL = +-2 g) gives worked register contents: 1 g reads
0x4009 = 16393 LSB and 350 mg reads 0x1669 = 5737 LSB. 0.061 mg/LSB predicts
16393.4 and 5737.7; a 32768/FS derivation predicts 16384 and 5734.4. The
accelerometer does not map its nominal full scale onto exactly 2^15 counts -
it has a small margin, the same phenomenon as the gyro, just far smaller.
So the old values were wrong by 0.0576%, and this is a correctness fix rather
than a consistency trade-off. The constants themselves are unchanged from the
previous commit; only the reasoning recorded beside them.
Corroborated four ways: the datasheet worked example, ST's upstream driver
(STMicroelectronics/lsm6dsv-pid, byte-identical to the copy this firmware
vendors), every example in STMems_Standard_C_drivers/lsm6dsv_STdC/examples, and
lsm6dsv_self_test.c in particular - its pass/fail limits are specified in mg, so
ST's own self-test only produces correct results if 0.122 mg/LSB is right.
Comment-only; 51 driver tests still pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent fe367a5 commit aa61da1
1 file changed
Lines changed: 20 additions & 16 deletions
Lines changed: 20 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
297 | 300 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
308 | 312 | | |
309 | 313 | | |
310 | 314 | | |
| |||
0 commit comments