AccelG248 incorrect values

The accelG248 appears to output the incorrect values.

The driver has the following code for accessing the current values

  
var data = this.ReadRegister(0x01, 6);

x = (data[0] << 2) | (data[1] >> 6);            
y = (data[2] << 2) | (data[3] >> 6);
z = (data[4] << 2) | (data[5] >> 6);

if (x > 511.0)
    x -= 1024.0;

if (y > 511.0)
    y -= 1024.0;

if (z > 511.0)
    z -= 1024.0;
        
x /= 512.0;            
y /= 512.0;            
z /= 512.0;

and the values (for instance the Z value when sat stationary) appear to be half of the expected result.

I found the datasheet here

[url]NXP® Semiconductors Official Site | NXP Semiconductors

which shows that the Digital Sensitivity (Counts/g) is 256. It’s obviously an easy fix but I just wondered if there is some other reason that these values (512 instead of 256) were used ?

I guess it would be nice to have it fixed in the SDK so you don’t need to keep adding the source code versions of the drivers.

1 Like

@ sh - That has been fixed for the next SDK. They’re divided by 256.0 now.