Hello Jozef,
Thanks again for your clear answers!
I implemented the AN13614 algorithms exactly as described, using these macros:
// LSB limits for compensated value
#define LSB_A_MIN 2 // LSB
#define LSB_A_MAX 1022 // LSB
// Number of half-bands from AN13614
#define HALF_BANDS_A 17.0f
// Band step size (G)
#define CALC_STEP(min, max) ( ((max) - (min)) / HALF_BANDS_A )
// Lower bound of a band (G)
#define CALC_BAND_MIN(acc_min, band, step) ( (acc_min) + ((band) * (step)) )
// Delta (G/LSB)
#define CALC_DELTA(step) ( (2.0f * (step)) / (LSB_A_MAX - LSB_A_MIN) )
// Offset (G)
#define CALC_OFFSET(band_min, delta) ( (band_min) - (LSB_A_MIN * (delta)) )
typedef enum {
BAND_0 = 0,
BAND_1,
…,
BAND_15
} accel_band_t;
For example, for –80 g…+90 g I did:
#define N80_90_MIN -80.0f
#define N80_90_MAX 90.0f
#define N80_90_STEP CALC_STEP(N80_90_MIN, N80_90_MAX)
#define N80_90_DELTA CALC_DELTA(N80_90_STEP)
#define N80_90_BAND0_MIN CALC_BAND_MIN(N80_90_MIN, 0, N80_90_STEP) // –80.0 g
#define N80_90_BAND0_OFFSET CALC_OFFSET(N80_90_BAND0_MIN, N80_90_DELTA)
… (bands 1 through 15)
Result: For the –80…+90 g range, my computed band limits and offsets match the datasheet exactly.
Issue: For the other ranges (–360…+400 g, –120…+520 g, –175…+550 g, –400…+400 g), my values diverge significantly from those listed in their datasheets.
Question: Is there any NXP reference (application note, errata, or spreadsheet) that provides the full set of ΔA, proof-inertia (@Aₘᵢₙ) and offset values for all 16 steps of each of the five acceleration ranges? Having those tables or formulas would help me validate and correct my implementation.
Thanks in advance for any pointers or documents you can share!
— Kafei