Skip to main content
keaven
Associate III
Aug 3, 2015 2:58 PM UTC
Question

__ADCX_FORCE_RESET() not seen

Posted on August 03, 2015 at 16:58

I am using the version 1.3.1. of stm32f4xx hal drivers. I am using the 3 ADCs. ADC1 and ADC2 in dual mode DMA interrupt driven and ADC3 regular conversion.

As you can in the code below I am using the functions __ADCx_FORCE_RESET() (x= 1, 2, and 3) . I dont understand why but the functions don't link. I get undefined symbol. I must use __ADC_FORCE_RESET() to get it work but it will reset all ADCs which I don't want. Any ideas why? Thank you

void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
{
if(hadc->Instance == ADC1)
{
/*##-1- Reset peripherals ##################################################*/
__ADC1_FORCE_RESET();
__ADC1_RELEASE_RESET();
/*##-2- Disable peripherals and GPIO Clocks ################################*/
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_3);
/*##-3- Disable the DMA Streams ############################################*/
HAL_DMA_DeInit(&hDMA2_ADC);
/*##-4- Disable the NVIC for DMA ###########################################*/
HAL_NVIC_DisableIRQ(DMA2_Stream0_IRQn);
}
if(hadc->Instance == ADC2)
{
/*##-1- Reset peripherals ##################################################*/
__ADC2_FORCE_RESET();
__ADC2_RELEASE_RESET();
}
if(hadc->Instance == ADC3)
{
/*##-1- Reset peripherals ##################################################*/
__ADC3_FORCE_RESET();
__ADC3_RELEASE_RESET();
/*##-2- Disable peripherals and GPIO Clocks ################################*/
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_7);
} 
}

    This topic has been closed for replies.

    4 replies

    Amel NASRI
    ST Technical Moderator
    Aug 4, 2015 1:24 PM UTC
    Posted on August 04, 2015 at 15:24

    Hi Keaven,

    The following functions are not defined in the ADC HAL driver:

    __ADC1_FORCE_RESET();

    __ADC1_RELEASE_RESET();  __ADC2_FORCE_RESET();

    __ADC2_RELEASE_RESET();  

    __ADC3_FORCE_RESET();

    __ADC3_RELEASE_RESET();

    You need to call:

    ADCxyz_FORCE_RESET();

    ADCxyz_RELEASE_RESET();

    Please note that current STM32CubeF4 package version is 1.7.0. For sure there are some enhancements made in version besides to the support of new F4 products.

    -Mayla-

    To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
    keaven
    keavenAuthor
    Associate III
    Aug 4, 2015 2:47 PM UTC
    Posted on August 04, 2015 at 16:47

    Hi Mayla,

    I validate the version and I am using 1.6.0 .  The reason that I am not up to date is simply I am getting the update from Keil uVision 5 package update.  It takes a bit longer to get the latest version.

    In which header file do I find ADCxyz_FORCE_RESET() macros? I cannot find them.

    Finally, the macros ADC1_FORCE_RESET() is present in stm32f4_hal_legacy.h.  Any reason why the build process cannot find them?

    Thank  you for your help.

    keaven
    keavenAuthor
    Associate III
    Aug 4, 2015 3:04 PM UTC
    Posted on August 04, 2015 at 17:04

    Hello again,

    I just noticed by looking at the STM32F4 reference manual ( RM0090) that the STM32F4 doesn't actually have seperate reset for ADC1, ADC2, or ADC3.  It has a common reset for the whole controller.

    So I have to use the common reset .

    Thank you again.

    Amel NASRI
    ST Technical Moderator
    Aug 4, 2015 3:55 PM UTC
    Posted on August 04, 2015 at 17:55

    You are right Keaven, there are no functions calledADCxyz_FORCE_RESET & ADCxyz_RELEASE_RESET I referred to the ADC example in Cube package where these are labels only used there.

    The correct ones are:

    __ADC_FORCE_RESET();
    __ADC_RELEASE_RESET();

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