AnsweredAssumed Answered

Driver problem in stm32f30x_tim.h

Question asked by fireout on Oct 20, 2015
Latest reply on Oct 20, 2015 by qwer.asdf
Hi
The driver version I am using is
  * @version V1.0.1
  * @date    23-October-2012
Is this an old version? If yes then where do I get a newer one?

My problem is when I call some of the functions such as TIM_SelectInputTrigger then it overwrites values written by TIM_SelectSlaveMode.
The problem appears to be the use of a 16 bit variable being used with a 32 bit variable. Perhaps it is just a setting I have wrong?

In the function the variable tmpsmcr is 16 bit and when it is written back to the register the upper 16 bits is cleared.
Any suggestions.. is this a bug or is this something I am doing wrong?

void TIM_SelectInputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource)
{
  uint16_t tmpsmcr = 0;
 
  /* Check the parameters */
  assert_param(IS_TIM_LIST2_PERIPH(TIMx));
  assert_param(IS_TIM_TRIGGER_SELECTION(TIM_InputTriggerSource));
 
  /* Get the TIMx SMCR register value */
  tmpsmcr = TIMx->SMCR;
 
  /* Reset the TS Bits */
  tmpsmcr &= (uint16_t)~TIM_SMCR_TS;
 
  /* Set the Input Trigger source */
  tmpsmcr |= TIM_InputTriggerSource;
 
  /* Write to TIMx SMCR */
  TIMx->SMCR = tmpsmcr;
}


Outcomes