2018-05-07 04:03 AM
I have a STM32L051 microcontroller and use the STM32L0Cube HAL.
I read fom the manual, that the STM32L0 have a possibility to provide a stable reference voltage for external ADC/DAC/... This is the VREF(BUF). If I understand correctly, using the CFGR3 register, I can enable the VREF, as well as check if it is ready. Additionally, I can choose to connect it to the PB0/1 output (SEL_VREF_OUT).
However in the examples provided, the VREF is only used internally for Comparator and ADCs, and not for external ICs.
Should I configure, say PB1, to be a standard DAC pin, and then using CFGR3 to connect it to the VREF?
Could someone give me some pointers on how to output the VREF on a PB1?
#vref #output #stm32l02018-05-07 06:18 AM
Not a part I'm using, but you should be able to export VREFINT via PB0/PB1 as an analogue output.
You should be able to measure the reference internally via ADC_IN17
2018-05-14 10:37 PM
if ( HALD_ADCEx_EnableVREFINT() != HAL_OK )
{ Error_Handling();}HAL_SYSCFG_VREFINT_OutputSelect(SYSCFG_VREFINT_OUT_PB1);is enough. I had issues due to an alternative use of the STM32L053 discovery board, where PB0 and PB1 are reserved for a sensor. Bridging SB23 and/or SB24 did the trick.