ROM version of adc_input_shift_config() includes wrong delay

ID: LPCBARESDK-998

Status: Open

First reported: 6.0.20.1338

Fixed in: TBD

Description

In the DA14531_01 the ROM version of the adc_input_shift_config() function is used.

#if !defined (__DA14531_01__) || defined (__EXCLUDE_ROM_ADC_531__)
void adc_input_shift_config(adc_input_sh_gain_t gain, adc_input_sh_cm_t cm)
{
#if !defined (__DA14535__)
    SetBits16(GP_ADC_CTRL_REG, GP_ADC_OFFS_SH_GAIN_SEL, gain);
    SetBits16(GP_ADC_CTRL2_REG, GP_ADC_OFFS_SH_CM, cm);

    adc_input_shift_enable();
#endif
}
#endif // __EXCLUDE_ROM_ADC_531__

This function includes a wrong delay for the shifter settling which is changed to 16us but the ROM version has about 13us.

Workaround

The RAM version should be used instead, apply this patch:

--- a/SDK_6.0.20/6.0.20.1338/sdk/common_project_files/misc/da14531_01_symbols.txt
+++ b/SDK_6.0.20/6.0.20.1338/sdk/common_project_files/misc/da14531_01_symbols.txt
@@ -1111,7 +1111,7 @@
 0x07f1ec65 T adc_reset
 ;0x07f1ec85 T adc_input_shift_enable
 ;0x07f1ec9d T adc_input_shift_disable
-0x07f1ecad T adc_input_shift_config
+;0x07f1ecad T adc_input_shift_config
 0x07f1ecd5 T adc_disable
 0x07f1ece5 T adc_start
 0x07f1ecf5 T adc_get_sample
--- a/SDK_6.0.20/6.0.20.1338/sdk/platform/driver/adc/adc_531.c
+++ b/SDK_6.0.20/6.0.20.1338/sdk/platform/driver/adc/adc_531.c
@@ -319,17 +319,16 @@ void adc_input_shift_disable(void)
 #endif
 }

-#if !defined (__DA14531_01__) || defined (__EXCLUDE_ROM_ADC_531__)
+#if !defined (__DA14535__)
 void adc_input_shift_config(adc_input_sh_gain_t gain, adc_input_sh_cm_t cm)
 {
-#if !defined (__DA14535__)
     SetBits16(GP_ADC_CTRL_REG, GP_ADC_OFFS_SH_GAIN_SEL, gain);
     SetBits16(GP_ADC_CTRL2_REG, GP_ADC_OFFS_SH_CM, cm);

     adc_input_shift_enable();
-#endif
+
 }
-#endif // __EXCLUDE_ROM_ADC_531__
+#endif