Skip to main content
Aaron Chang
Associate II
August 21, 2017
Question

Is this a bug that STM32H743 HAL_ADC_Stop_DMA clears ADC_CFGR_DMNGT?

  • August 21, 2017
  • 1 reply
  • 598 views
Posted on August 21, 2017 at 11:48

Hello,

    In the line 1760 of 'stm32h7xx_hal_adc.c' in pack 'STM32H7xx_DFP 1.0.1':

'''

   /* Disable ADC DMA (ADC DMA configuration ADC_CFGR_DMNGT is kept) */

   MODIFY_REG(hadc->Instance->CFGR, ADC_CFGR_DMNGT_0 |ADC_CFGR_DMNGT_1, 0);

'''

    The comment says 'keep the DMNGT' while the code actually clears it.  Besides 

it doesn't make much sense to me that calling a 'HAL_ADC_Stop_DMA' could change the initial configuration of ADC.

    Is this a bug?  Or 'HAL_ADC_Stop_DMA' is not something I should call under normal condition?

    This topic has been closed for replies.

    1 reply

    Amel NASRI
    ST Technical Moderator
    August 23, 2017
    Posted on August 23, 2017 at 18:02

    Hi

    aaron_chang

    ‌,

    It seems the comment 'Disable ADC DMA (ADC DMA configuration ADC_CFGR_DMNGT is kept)' creates confusion for you.

    In fact here,ADC_CFGR_DMNGT have to be cleared because the call ofADC_ConversionStop doesn't clear them: they are kept as they are.

    So this is not a bug.

    HAL_ADC_Stop_DMA may be useful in an application where ADC configuration needs to be modified for example to start with a new mode.

    -Amel

    To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.