Skip to main content
osiauhwa
Associate
June 7, 2017
Solved

__HAL_TIM_SET_PRESCALER error

  • June 7, 2017
  • 4 replies
  • 1770 views
Posted on June 07, 2017 at 22:50

Hi,

I tried this code :

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)

{

/* USER CODE BEGIN Callback 1 */

    if (htim->Instance == TIM2) {

    HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);

        __HAL_TIM_SET_PRESCALER(&htim2, 30000);

  }

/* USER CODE END Callback 1 */

}

but gave me :

../Src/main.c(286): error:  &sharp20: identifier '__PRESC__' is undefined

../Src/main.c(286): error:  &sharp20: identifier '__HANDLE__' is undefined

But if I tried :

__HAL_TIM_SET_COUNTER or others macro, there was no error...

Any clue on how to resolve this ...

Thank you

#__hal_tim_set_prescaler
    This topic has been closed for replies.
    Best answer by Zt Liu
    Posted on June 08, 2017 at 04:36

    ong.siau

    ‌

    You might havediscovered a typing error!!!

    in my stm32f3xx_hal_tim.h file.

    it's

    __HAL_TIM_SET_PRESCALE

    R (

    __HANDLE__, __PRESC__) ((__HANDLE__)->Instance->PSC = (__PRESC__))

    it should be

    __HAL_TIM_SET_PRESCALE

    R(

    __HANDLE__, __PRESC__) ((__HANDLE__)->Instance->PSC = (__PRESC__))

    there is a space between 'R' and '('.

    Good luck!

    4 replies

    Zt Liu
    Zt LiuBest answer
    Senior III
    June 8, 2017
    Posted on June 08, 2017 at 04:36

    ong.siau

    ‌

    You might havediscovered a typing error!!!

    in my stm32f3xx_hal_tim.h file.

    it's

    __HAL_TIM_SET_PRESCALE

    R (

    __HANDLE__, __PRESC__) ((__HANDLE__)->Instance->PSC = (__PRESC__))

    it should be

    __HAL_TIM_SET_PRESCALE

    R(

    __HANDLE__, __PRESC__) ((__HANDLE__)->Instance->PSC = (__PRESC__))

    there is a space between 'R' and '('.

    Good luck!

    osiauhwa
    osiauhwaAuthor
    Associate
    June 8, 2017
    Posted on June 08, 2017 at 18:18

    Hi Zhitai,

    Good Catch !

    I think ST should fixed this on the next revision of Cube_FW

    Thank you so much !

    Zt Liu
    Senior III
    June 8, 2017
    Posted on June 08, 2017 at 18:23

    I hope you don't laugh....

    This redundant space took me about 40 mins to discover.....

    :((

    ST Technical Moderator
    June 8, 2017
    Posted on June 08, 2017 at 20:48

    Hello,

    I confirm your reported issue.

    I will raise this internally to fix in coming releases.

    Thanks

    Imen

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks