From f19b4e536c28bde92ad49d52ad56146d318612ad Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Fri, 26 Aug 2016 12:49:00 +0000 Subject: Fixed bug #773. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9750 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.c | 8 ++++++-- readme.txt | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.c b/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.c index 2e22581ed..816929e81 100644 --- a/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.c +++ b/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.c @@ -221,6 +221,8 @@ void dac_lld_start(DACDriver *dacp) { /* If the driver is in DAC_STOP state then a full initialization is required.*/ if (dacp->state == DAC_STOP) { + dacchannel_t channel = 0; + /* Enabling the clock source.*/ #if STM32_DAC_USE_DAC1_CH1 if (&DACD1 == dacp) { @@ -231,6 +233,7 @@ void dac_lld_start(DACDriver *dacp) { #if STM32_DAC_USE_DAC1_CH2 if (&DACD2 == dacp) { rccEnableDAC1(false); + channel = 1; } #endif @@ -243,6 +246,7 @@ void dac_lld_start(DACDriver *dacp) { #if STM32_DAC_USE_DAC2_CH2 if (&DACD3 == dacp) { rccEnableDAC2(false); + channel = 1; } #endif @@ -251,7 +255,7 @@ void dac_lld_start(DACDriver *dacp) { #if STM32_DAC_DUAL_MODE == FALSE dacp->params->dac->CR &= dacp->params->regmask; dacp->params->dac->CR |= DAC_CR_EN1 << dacp->params->regshift; - dac_lld_put_channel(dacp, 0U, dacp->config->init); + dac_lld_put_channel(dacp, channel, dacp->config->init); #else if ((dacp->config->datamode == DAC_DHRM_12BIT_RIGHT_DUAL) || (dacp->config->datamode == DAC_DHRM_12BIT_LEFT_DUAL) || @@ -262,7 +266,7 @@ void dac_lld_start(DACDriver *dacp) { else { dacp->params->dac->CR = DAC_CR_EN1; } - dac_lld_put_channel(dacp, 0U, dacp->config->init); + dac_lld_put_channel(dacp, channel, dacp->config->init); #endif } } diff --git a/readme.txt b/readme.txt index 2d6057f25..f03c62710 100644 --- a/readme.txt +++ b/readme.txt @@ -123,6 +123,8 @@ - RT: Merged RT4. - NIL: Merged NIL2. - NIL: Added STM32F7 demo. +- HAL: Fixed invalid output initialization for STM32 DACx channels 2 + (bug #772)(backported to 16.1.6). - HAL: Fixed CAN inclusion path missing for STM32F107 (bug #772)(backported to 16.1.6). - HAL: Fixed extra brackets in STM32F0 registry (bug #771)(backported -- cgit v1.2.3