diff --git a/Source/hoc-clk/sysmodule/src/aotag.cpp b/Source/hoc-clk/sysmodule/src/aotag.cpp index 5180afc5..35cd372c 100644 --- a/Source/hoc-clk/sysmodule/src/aotag.cpp +++ b/Source/hoc-clk/sysmodule/src/aotag.cpp @@ -81,15 +81,31 @@ namespace aotag { .tsample_ate = 39, }; - // These coeffs are likely NOT accurate. Probably need to dump them from L4T? + /* + Calculate AOTAG coeffs: + offset_C = 5000 + halfA = low millis * 2 - offset_C * 2 + halfB = high millis * 2 - offset_C * 2 + + count_A = (aotag_half_A + |thermb|) × 8192 / therma + count_B = (aotag_half_B + |thermb|) × 8192 / therma + therma_target = (soctherm_half_B - soctherm_half_A) × 8192 / (count_B - count_A) + + thermb_target = (soctherm_half_A - D×2) - therma_target × count_A / 8192 + + alpha = therma_target x 1,000,000 / therma_raw + + beta = thermb_target x 1,000,000 - thermb_raw × alpha + */ + static const struct FuseCorrCoeff tegra_aotag_coeff = { - .alpha = 4496200, - .beta = -4496200, + .alpha = 1290000, + .beta = 40500000, }; static const struct FuseCorrCoeff tegra210b01_aotag_coeff = { - .alpha = 4496200, - .beta = -4496200, + .alpha = 1290000, + .beta = 40500000, }; struct aotag_sensor_info_t { @@ -219,7 +235,6 @@ namespace aotag { thermb = div64_s64_precise(temp, CALIB_COEFFICIENT); calib = ((u16)therma << SENSOR_CONFIG2_THERMA_SHIFT) | ((u16)thermb << SENSOR_CONFIG2_THERMB_SHIFT); - *calibration = calib; }