Skip to main content
sebastien239955_stm1
Associate
June 23, 2015
Question

Bad operation in stm32l0xx_hal_tim.c

  • June 23, 2015
  • 2 replies
  • 758 views
Posted on June 23, 2015 at 11:07

Hello,

I do not understand why the TIMER instance is stopped when a specific bloc is stopped.

For example, I have 2 output compare channels activated on TIM2 with interruptions.

If I use HAL_TIM_OC_Stop_IT in order to stop one of these OC bloc, the HAL ''__HAL_TIM_DISABLE(htim)'' is called and so the result is a complete stop of the TIM2 (and so my second OC is not running anymore).

I think this is not a good operation, what do you think ?

Thanks !
    This topic has been closed for replies.

    2 replies

    chrif
    Visitor II
    July 2, 2015
    Posted on July 02, 2015 at 13:05

    Hi,

    The function ''__HAL_TIM_DISABLE(htim)'' disable the counter (so all the timer is stopped) only if all channels are disabled.The mask ''

    CCER_CCxE_MASK

    '' corresponds to CCxE bits (Capture/Compare output enable)in the TIMx_CCER register.

    #define __HAL_TIM_DISABLE(__HANDLE__) \ 
    do
    { \ 
    if
    (((__HANDLE__)->Instance->CCER & CCER_CCxE_MASK) == 0) \ 
    { \ 
    (__HANDLE__)->Instance->CR1 &= ~(TIM_CR1_CEN); \ 
    } \ 
    } 
    while
    (0) 

    But, I'm wondering if you tested really the issue or you have concluded that the timer is stopped only by referrring to the code? Regards
    sebastien239955_stm1
    Associate
    July 3, 2015
    Posted on July 03, 2015 at 09:46

    Hi,

    Thank you for your help and sorry because it's true that it was during my analysis of the libraries. It works properly. Thanks again !!