Skip to content

APPS Calibration Procedure

Tim Brewis edited this page Jul 1, 2022 · 1 revision

APPS Calibration Procedure

Background

  • The APPS (accelerator pedal position sensor) outputs two analogue signals corresponding to the pedal position.
  • Each signal has a different transfer function (and range).
  • The VCU measures each signal using an ADC.
  • The raw ADC reading is mapped from [APPS_*_ADC_MIN, APPS_*_ADC_MAX] to [0, 2¹⁰ - 1] (where * = 1 or 2).
  • To map correctly, the minimum and maximum raw ADC readings across the full range of motion of the pedal need to be measured and set in config.h.

Calibration

  1. Open apps.c and insert the following logpoint after the call to read_adcs():

    "APPS_1: %u\tAPPS_2: %u" readings[0] readings[1]
  2. Build the program in debug mode and flash it to the STM32.

  3. Start a debug session.

  4. Complete the ready-to-drive procedure.

  5. Fully release the pedal and note down the raw ADC readings printed by the logpoint. There is usually some noise which can be ignored, just record the rough value. These measurements correspond to APPS_1_ADC_MIN and APPS_2_ADC_MIN.

  6. Repeat the previous step with the pedal fully pressed. These measurements correspond to APPS_1_ADC_MAX and APPS_2_ADC_MAX.

  7. Set the values of APPS_1_ADC_MIN, APPS_2_ADC_MIN, APPS_1_ADC_MAX and APPS_2_ADC_MAX in config.h. For minimum values, set the actual value slightly above the measurement. For maximum values, set the actual value slightly below the measurement. This helps account for issues such as small measurement errors, mechanical misalignment and drift over time.

Verification

  1. Remove the logpoint from the calibration procedure and insert the following (identical) logpoint after the calls to map_adc_reading():

    "APPS_1: %u\tAPPS_2: %u" readings[0] readings[1]
  2. Restart the debug session.

  3. Complete the ready-to-drive procedure.

  4. Fully release the pedal.

    • Both values should read zero.
    • If a value is non-zero, increase the corresponding APPS_*_ADC_MIN slightly.
  5. Fully press the pedal.

    • Both values should read the maximum of (2¹⁰ - 1).
    • If a value is not at the maximum, decrease the corresponding APPS_*_ADC_MAX slightly.
  6. Begin with the pedal released and slowly press it all the way down.

    • Both values should begin increasing at the same time.
    • If one value begins increasing before the other, either increase APPS_*_ADC_MIN for that value, or decrease it for the other value. Make sure that this change does not affect step 4.
    • Both values should reach the maximum at the same time.
    • If one value reaches the maximum before the other, either decrease APPS_*_ADC_MAX for that value, or increase it for the other value. Make sure that this change does not affect step 5.
    • Both values should follow each other reasonably closely. If one increases faster than the other, check the calibration of the maximum values.