-
Notifications
You must be signed in to change notification settings - Fork 6
APPS Calibration Procedure
- 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
.
-
Open
apps.c
and insert the following logpoint after the call toread_adcs()
:"APPS_1: %u\tAPPS_2: %u" readings[0] readings[1]
-
Build the program in debug mode and flash it to the STM32.
-
Start a debug session.
-
Complete the ready-to-drive procedure.
-
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
andAPPS_2_ADC_MIN
. -
Repeat the previous step with the pedal fully pressed. These measurements correspond to
APPS_1_ADC_MAX
andAPPS_2_ADC_MAX
. -
Set the values of
APPS_1_ADC_MIN
,APPS_2_ADC_MIN
,APPS_1_ADC_MAX
andAPPS_2_ADC_MAX
inconfig.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.
-
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]
-
Restart the debug session.
-
Complete the ready-to-drive procedure.
-
Fully release the pedal.
- Both values should read zero.
- If a value is non-zero, increase the corresponding
APPS_*_ADC_MIN
slightly.
-
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.
-
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.