diff --git a/components/driver/Kconfig b/components/driver/Kconfig new file mode 100644 index 000000000..7ef1a7f75 --- /dev/null +++ b/components/driver/Kconfig @@ -0,0 +1,16 @@ +#menu "Driver configurations" + +menu "ADC configuration" + +config ADC_FORCE_XPD_FSM + bool "Use the FSM to control ADC power" + default n + help + ADC power can be controlled by the FSM instead of software. This allows the ADC to + be shut off when it is not working leading to lower power consumption. However + using the FSM control ADC power will increase the noise of ADC. + +endmenu # ADC Configuration + +#endmenu # Driver configurations + diff --git a/components/driver/rtc_module.c b/components/driver/rtc_module.c index 0d3974c5c..10833c92e 100644 --- a/components/driver/rtc_module.c +++ b/components/driver/rtc_module.c @@ -1046,11 +1046,18 @@ void adc_power_always_on() void adc_power_on() { portENTER_CRITICAL(&rtc_spinlock); + //The power FSM controlled mode saves more power, while the ADC noise may get increased. +#ifndef CONFIG_ADC_FORCE_XPD_FSM + //Set the power always on to increase precision. + SENS.sar_meas_wait2.force_xpd_sar = SENS_FORCE_XPD_SAR_PU; +#else + //Use the FSM to turn off the power while not used to save power. if (SENS.sar_meas_wait2.force_xpd_sar & SENS_FORCE_XPD_SAR_SW_M) { SENS.sar_meas_wait2.force_xpd_sar = SENS_FORCE_XPD_SAR_PU; } else { SENS.sar_meas_wait2.force_xpd_sar = SENS_FORCE_XPD_SAR_FSM; } +#endif portEXIT_CRITICAL(&rtc_spinlock); } @@ -1466,6 +1473,8 @@ static inline void adc2_config_width(adc_bits_width_t width_bit) portENTER_CRITICAL(&rtc_spinlock); //sar_start_force shared with ADC1 SENS.sar_start_force.sar2_bit_width = width_bit; + //cct set to the same value with PHY + SENS.sar_start_force.sar2_pwdet_cct = 4; portEXIT_CRITICAL(&rtc_spinlock); //Invert the adc value,the Output value is invert