From b37597f1dbf5938dc5602d9e38a11de3aa4a1b98 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Mon, 19 May 2014 10:29:11 +0000 Subject: [PATCH] stm32/dac: Follow ref-man guidelines on GPIO config GPIO pins should be configured for Analog IN on virtually all families to reduce parasitic consumption. Reported-by: Roger Wolff --- lib/stm32/common/dac_common_all.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/stm32/common/dac_common_all.c b/lib/stm32/common/dac_common_all.c index e3b5aae8..a8a0daf8 100644 --- a/lib/stm32/common/dac_common_all.c +++ b/lib/stm32/common/dac_common_all.c @@ -11,8 +11,11 @@ of the connection line, high density and XL devices. Two DAC channels are available, however unlike the ADC channels these are separate DAC devices controlled by the same register block. -The DAC is on APB1. Its clock must be enabled in RCC and the GPIO +The DAC is on APB1. Its clock must be enabled in RCC and depending on +specific family, the GPIO ports set to alternate function output before it can be used. +On most families, the GPIO pins should be configured to Analog IN to +avoid parasitic consumption. The digital output driver is disabled so the output driver mode (push-pull/open drain) is arbitrary. @@ -48,7 +51,7 @@ by specifying the appropriate register to the DMA controller. @section dac_api_basic_ex Basic DAC handling API. -Set the DAC's GPIO port to any alternate function output mode. Enable the +Set the DAC's GPIO port to Analog IN. Enable the DAC clock. Enable the DAC, set a trigger source and load the buffer with the first value. After the DAC is triggered, load the buffer with the next value. This example uses software triggering and added noise.