In current trunk and stable branch it seems an error in adc v.3 driver:
In function adc_lld_vreg_on used erorrnous macro ADC_CR_ADVREGEN while in function adc_lld_vreg_off used right macro ADC_CR_DEEPPWD.
Code: Select all
.\os\hal\ports\STM32\LLD\ADCv3\hal_adc_lld.c
...
129 /**
130 * @brief Enables the ADC voltage regulator.
131 *
132 * @param[in] adcp pointer to the @p ADCDriver object
133 */
134 static void adc_lld_vreg_on(ADCDriver *adcp) {
135
136 adcp->adcm->CR = 0; /* See RM.*/
137 adcp->adcm->CR = ADC_CR_ADVREGEN;
138 #if STM32_ADC_DUAL_MODE
139 adcp->adcs->CR = ADC_CR_ADVREGEN;
140 #endif
141 osalSysPolledDelayX(OSAL_US2RTC(STM32_HCLK, 20));
142 }
143
144 /**
145 * @brief Disables the ADC voltage regulator.
146 *
147 * @param[in] adcp pointer to the @p ADCDriver object
148 */
149 static void adc_lld_vreg_off(ADCDriver *adcp) {
150
151 adcp->adcm->CR = 0; /* See RM.*/
152 adcp->adcm->CR = ADC_CR_DEEPPWD;
153 #if STM32_ADC_DUAL_MODE
154 adcp->adcs->CR = 0;
155 adcp->adcs->CR = ADC_CR_DEEPPWD;
156 #endif
157 }
...
The macro ADC_CR_ADVREGEN is defined in file "stm32f303xc.h" as
Code: Select all
...
1042 #define ADC_CR_ADVREGEN_Msk (0x3U << ADC_CR_ADVREGEN_Pos) /*!< 0x30000000 */
1043 #define ADC_CR_ADVREGEN ADC_CR_ADVREGEN_Msk /*!< ADC voltage regulator enable */
1044 #define ADC_CR_ADVREGEN_0 (0x1U << ADC_CR_ADVREGEN_Pos) /*!< 0x10000000 */
1045 #define ADC_CR_ADVREGEN_1 (0x2U << ADC_CR_ADVREGEN_Pos) /*!< 0x20000000 */
...
but there must be used another macros but it is not work
Code: Select all
.\os\hal\ports\STM32\LLD\ADCv3\hal_adc_lld.c
79 #if !defined(ADC_CR_ADVREGEN)
80 #define ADC_CR_ADVREGEN ADC_CR_ADVREGEN_0
81 #endif
Also this macro used in assertion code in function adc_lld_calibration.