K_berich.Jan

STM32F4 HAL ADC Bug report

Discussion created by K_berich.Jan on Mar 2, 2017

Hi,

 

there is a problem in the current version (1.6.0) when using the ADC in dual mode while also attempting to start ADC3 independently. In this case ADC3 doesn't start.

In the HAL_ADC_START, HAL_ADC_START_IT and HAL_ADC_START_DMA functions it is checked whether the ADC is configured in Multimode. However, this prevents additional independent ADCs to start.

 

For my purposes on an STM32F407 it was sufficient to change the lines:


    /* Check if Multimode enabled */
    if(HAL_IS_BIT_CLR(ADC->CCR, ADC_CCR_MULTI)

 

to:

 

    /* Check if Multimode enabled */
    if(HAL_IS_BIT_CLR(ADC->CCR, ADC_CCR_MULTI) || (hadc->Instance == ADC3
            && HAL_IS_BIT_CLR(ADC->CCR, ADC_CCR_MULTI_4)))

 

in each of this functions.

Outcomes