From 02be9e1e2d937afd99d37b259720a259d734775e Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 1 May 2017 07:39:32 -0400 Subject: [PATCH] ADC fast mode was not configured for all possible pins --- firmware/hw_layer/adc_inputs.cpp | 30 ++++++++++++++++++++++++++---- firmware/rusefi.cpp | 2 +- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/firmware/hw_layer/adc_inputs.cpp b/firmware/hw_layer/adc_inputs.cpp index 66becf2abf..175f6088d4 100644 --- a/firmware/hw_layer/adc_inputs.cpp +++ b/firmware/hw_layer/adc_inputs.cpp @@ -98,7 +98,10 @@ static ADCConversionGroup adcgrpcfgSlow = { FALSE, 0, adc_callback_slow, NULL, /* HW dependent part.*/ ADC_TwoSamplingDelay_20Cycles, // cr1 ADC_CR2_SWSTART, // cr2 - +/** + * here we configure all possible channels for slow mode. Some channels would not actually + * be used hopefully that's fine to configure all possible channels. + */ ADC_SMPR1_SMP_AN10(ADC_SAMPLING_SLOW) | ADC_SMPR1_SMP_AN11(ADC_SAMPLING_SLOW) | ADC_SMPR1_SMP_AN12(ADC_SAMPLING_SLOW) | @@ -132,9 +135,28 @@ static ADCConversionGroup adcgrpcfg_fast = { FALSE, 0 /* num_channels */, adc_ca ADC_TwoSamplingDelay_5Cycles, // cr1 ADC_CR2_SWSTART, // cr2 - 0, // sample times for channels 10...18 - // todo: IS SOMETHING MISSING HERE? - ADC_SMPR2_SMP_AN0(ADC_SAMPLING_FAST), // In this field must be specified the sample times for channels 0...9 + /** + * here we configure all possible channels for fast mode. Some channels would not actually + * be used hopefully that's fine to configure all possible channels. + * + */ + ADC_SMPR1_SMP_AN10(ADC_SAMPLING_FAST) | + ADC_SMPR1_SMP_AN11(ADC_SAMPLING_FAST) | + ADC_SMPR1_SMP_AN12(ADC_SAMPLING_FAST) | + ADC_SMPR1_SMP_AN13(ADC_SAMPLING_FAST) | + ADC_SMPR1_SMP_AN14(ADC_SAMPLING_FAST) | + ADC_SMPR1_SMP_AN15(ADC_SAMPLING_FAST) + , // sample times for channels 10...18 + ADC_SMPR2_SMP_AN0(ADC_SAMPLING_FAST) | + ADC_SMPR2_SMP_AN1(ADC_SAMPLING_FAST) | + ADC_SMPR2_SMP_AN2(ADC_SAMPLING_FAST) | + ADC_SMPR2_SMP_AN3(ADC_SAMPLING_FAST) | + ADC_SMPR2_SMP_AN4(ADC_SAMPLING_FAST) | + ADC_SMPR2_SMP_AN5(ADC_SAMPLING_FAST) | + ADC_SMPR2_SMP_AN6(ADC_SAMPLING_FAST) | + ADC_SMPR2_SMP_AN7(ADC_SAMPLING_FAST) | + ADC_SMPR2_SMP_AN8(ADC_SAMPLING_FAST) | + ADC_SMPR2_SMP_AN9(ADC_SAMPLING_FAST), // In this field must be specified the sample times for channels 0...9 0, // Conversion group sequence 13...16 + sequence length diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 139b332c76..c7db2863fb 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -251,5 +251,5 @@ int getRusEfiVersion(void) { return 123; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE[0] * 0 != 0) return 3211; // this is here to make the compiler happy about the unused array - return 20170429; + return 20170501; }