MasterPlayer / adxl345-sv

FPGA implemented component for realize register file in FPGA resources with request and sends data to ADXL345 device
MIT License
3 stars 0 forks source link

Software API can perform calibration process #8

Closed MasterPlayer closed 2 years ago

MasterPlayer commented 2 years ago

Calibration includes next steps :

  1. Read current data N times
  2. Calculate average for this times
  3. Round them
  4. Update OFSX, OFSY, OFSZ registers in device

Calibration completed

or not?

MasterPlayer commented 2 years ago

in full-resolution mode for range -2g to 2g: calculations : 10 bit = [-512..511] `|-2g..2g| = 4g 4g = 1024 LSB 1 LSB = 4g/1024lsb = 0.00390625 g this is DATAX, DATAY, DATAZ registers Precision of this mode = 0.00390625g/LSB

offset = 8 bit -128..127 range Scale factor of offset register = 15.6 mg/LSB

for example, if reading data = 230 in decimal, but must 256, then 230 - 256 = -26 260.00390625 = 0.1015625 g 230 0.00390625 = 0.8984375 g 26/(Scale(offset)/Scale(data)) = -Round(-26/4) = 6 a 6 value we must write to register OFSX

Now, we need calculate average value, then calculate OFFSET and write them to registers.

MasterPlayer commented 2 years ago

Rule : 1 LSB of offset register correct 4 LSB of data register

MasterPlayer commented 2 years ago

But : need support for various Sensitivities and various Scale factors

MasterPlayer commented 2 years ago

but need analyze FULL_RES flaq in DATA_FORMAT registry