Errata : STM32G DAC use precludes use of associated GPIO pin, even when DAC output disabled.
I have found something which is unexpected behaviour / errata in the STM32G071's DAC.
In summary, once the DAC channel is enabled (in this case I'm using CH2) then the pin cannot be used as a normal GPIO output, even if the DAC's output buffer is disabled and its mode is set to 011 or 111 (DAC routed to on chip peripherals with buffer disabled). The manual seems to indicate otherwise, but is unclear. (15.2 says "Each DAC output can be disconnected from the DAC_OUTx output pin").
Test setup as follows :
STM32G071xRB Nucleo64 board:
PA5 (the LED pin) set to :
MODE for PA5 = 0x1 (output)
OTYPER for PA5 = 0 (push/pull)
OSPEEDR = 0 (low speed)
LCKR = 0
AFRL for PA5 set to 0
DAC CH1 and 2 set up :
DAC->CR EN1 and 2 set, no other bits
DAC->MCR MODE1 and MODE2 set to 0x3 or 0x7 (DAC channel connected to on-chip peripherals with buffer disabled - tested with both 0x3 and 0x7)
I am using Keil and testing the results in the debugger, but observed same behaviour when running normally.
Interestingly, the pull-up on PA5 still functions if the PUPDR is set, thus lighting the LED, however the port output data register does not influence the LED at all until DAC channel 2 is disabled.
If this is not viewed as errata then suggest the manual be updated promptly to make it clear that use of the DAC channel precludes use of the associated pin as GPIO. Can anyone else confirm this errata?