2020-07-10 02:13 PM
Hello,
I'm working on my own E load test equipment for my lab that will double as a battery capacity tester and I decided to use out lovely favorite chip the stm32F411ECU AKA "Black pill"
So I've set up the conversion amount to around 20 @ continues mode and migrating from the arduino world I know that in order to eliminate the background noise of the 3.3V regulator that the stm32 usually take reference from you can setup an Internal voltage reference that usually comes built in the chip.
So the question it does the STM32F411EC have an internal VRef? how many? how stable? how do you set it up?
2020-07-10 02:27 PM
Fount this using LL abstraction but how do you use it?:
__STATIC_INLINE void LL_ADC_SetCommonPathInternalCh ( ADC_Common_TypeDef * ADCxy_COMMON,
uint32_t PathInternal
)
Set parameter common to several ADC: measurement path to internal channels (VrefInt, temperature sensor, ...).
One or several values can be selected. Example: (LL_ADC_PATH_INTERNAL_VREFINT | LL_ADC_PATH_INTERNAL_TEMPSENSOR)
Note:
On this STM32 family, setting of this feature is conditioned to ADC state: All ADC instances of the ADC common group must be disabled. This check can be done with function LL_ADC_IsEnabled() for each ADC instance or by using helper macro helper macro __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(). CCR VREFEN LL_ADC_SetCommonPathInternalCh
CCR TSEN LL_ADC_SetCommonPathInternalCh
CCR VBATEN LL_ADC_SetCommonPathInternalCh
Parameters:
ADCxy_COMMON ADC common instance (can be set directly from CMSIS definition or by using helper macro __LL_ADC_COMMON_INSTANCE() )
PathInternal This parameter can be a combination of the following values:
LL_ADC_PATH_INTERNAL_NONE
LL_ADC_PATH_INTERNAL_VREFINT
LL_ADC_PATH_INTERNAL_TEMPSENSOR
LL_ADC_PATH_INTERNAL_VBAT
Return values:
None
2020-07-10 02:59 PM
Rather than reading arbitrary functions descriptions, read the appropriate chapters of reference manual.
The internal reference is probably not usable as a direct reference to the ADC, unless this STM32 has a way to connect it to the VREF+ pin (through VREFBUF module - I didn't check but I doubt any 'F4 has this).
On smaller packages VREF+ is internally connected to VDDA, so you don't have much options to improve on that, except serious filtering (note that VDDA must not depart much from VDD). Also, ADCs on heavily digital circuits are disappointingly noisy, principally, so better don't hold your breath and be prepared to move to an external ADC if you won't be able to achieve performance you require.
JW
2020-07-10 03:56 PM
Don't confuse VREFINT for a voltage reference usable by the ADC. It's a ~1.21V internal signal readable by one ADC channel. Details in the datasheet.
If VDDA/VREF+ has a high ripple current, nothing is going to be able to reduce the noise from that, apart from averaging many samples.
2020-07-11 02:27 AM
So there is no actual way to improve the accuracy of the ADC reading except over sampling or get an external ADC?
2020-07-11 07:17 AM
Read AN2834 to see your options:
2020-07-12 05:13 AM
This is nice and all but nothing about how to setup an external voltage reference in software...
2020-07-12 05:22 AM
2020-07-14 04:20 AM
huh, OK thank you then I think you can't set it much with the stm32f411CE black pill module.