2016-06-13 07:33 AM
Hi,
I have found a bug inside functionTIM_SetIC2Prescaler() fromSTM32L1xx_StdPeriph_Lib_V1.3.1,which is the latest version. The current code is:void TIM_SetIC2Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC)
{
/* Check the parameters */
assert_param(IS_TIM_LIST2_PERIPH(TIMx));
assert_param(IS_TIM_IC_PRESCALER(TIM_ICPSC));
/* Reset the IC2PSC Bits */
TIMx->CCMR1 &= (uint16_t)~((uint16_t)TIM_CCMR1_IC2PSC);
/* Set the IC2PSC value */
TIMx->CCMR1 |= (uint16_t)(TIM_ICPSC << 8);
}
The bit
TIM_ICPSC should be shift by 10, not 8!
TIMx->CCMR1 |= (uint16_t)(TIM_ICPSC << 10); // BUG: IC2PSC is Bits 11:10, not bit 8
#stm32l151
2016-06-14 01:35 AM
Hi maciel.vinicius,
Thanks for the feedback. I report it internally.-Hannibal-2016-06-14 04:18 AM
Hi Hannibal,
Actually I made a mistake, sorry. :( The function is correct.