2012-04-19 10:43 AM
like this: I don't know why selecting opposite polarity !
/* Select the Opposite Input Polarity */
if (TIM_ICInitStruct->TIM_ICPolarity == TIM_ICPolarity_Rising) { icoppositepolarity = TIM_ICPolarity_Falling; } else { icoppositepolarity = TIM_ICPolarity_Rising; }wait for help .thanks in advance! #great?thanks-! #wait-for-you--clive1-!-!-! #thanks-for-your-help-!-! #great?thanks-! #great?thanks-! #the-doubt-in-m4-discovery-input #haha #wait-for-you #xie-xie-ni-clivel1-!!-thanks-!2012-04-19 11:16 AM
Doesn't it related to setting the paired channel with the reverse/opposite conditions.
TI1_Config vs TI2_Config/**
* @brief Configures the TIM peripheral according to the specified parameters * in the TIM_ICInitStruct to measure an external PWM signal. * @param TIMx: where x can be 1, 2, 3, 4, 5,8, 9 or 12 to select the TIM * peripheral. * @param TIM_ICInitStruct: pointer to a TIM_ICInitTypeDef structure that contains * the configuration information for the specified TIM peripheral. * @retval None */ void TIM_PWMIConfig(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct) { uint16_t icoppositepolarity = TIM_ICPolarity_Rising; uint16_t icoppositeselection = TIM_ICSelection_DirectTI; /* Check the parameters */ assert_param(IS_TIM_LIST2_PERIPH(TIMx)); /* Select the Opposite Input Polarity */ if (TIM_ICInitStruct->TIM_ICPolarity == TIM_ICPolarity_Rising) { icoppositepolarity = TIM_ICPolarity_Falling; } else { icoppositepolarity = TIM_ICPolarity_Rising; } /* Select the Opposite Input */ if (TIM_ICInitStruct->TIM_ICSelection == TIM_ICSelection_DirectTI) { icoppositeselection = TIM_ICSelection_IndirectTI; } else { icoppositeselection = TIM_ICSelection_DirectTI; } if (TIM_ICInitStruct->TIM_Channel == TIM_Channel_1) { /* TI1 Configuration */ TI1_Config(TIMx, TIM_ICInitStruct->TIM_ICPolarity, TIM_ICInitStruct->TIM_ICSelection, TIM_ICInitStruct->TIM_ICFilter); /* Set the Input Capture Prescaler value */ TIM_SetIC1Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); /* TI2 Configuration */ TI2_Config(TIMx, icoppositepolarity, icoppositeselection, TIM_ICInitStruct->TIM_ICFilter); /* Set the Input Capture Prescaler value */ TIM_SetIC2Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); } else { /* TI2 Configuration */ TI2_Config(TIMx, TIM_ICInitStruct->TIM_ICPolarity, TIM_ICInitStruct->TIM_ICSelection, TIM_ICInitStruct->TIM_ICFilter); /* Set the Input Capture Prescaler value */ TIM_SetIC2Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); /* TI1 Configuration */ TI1_Config(TIMx, icoppositepolarity, icoppositeselection, TIM_ICInitStruct->TIM_ICFilter); /* Set the Input Capture Prescaler value */ TIM_SetIC1Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); } }2012-04-20 06:45 AM
2012-04-20 08:12 AM
You should review the block diagrams in the manual.
Timer channels 1 & 2 pair, and 3 & 4 pair. You can route CH2_TIM input into the CCR1 counter/latch. Look at the muxes to see what/how the signals route. The CCR2 register latches the ticks of the timebase, get two measurements out of CCR2 the delta ticks provides the period. CCR1 gets you the ability to determine the duty. Say your timebase is 72 MHz at first interrupt CCR2 = 1000 at second interrupt CCR2 = 2000 These 1000 ticks between the two interrupts mean you've measured 72 KHz at PB7 (TIM4_CH2)2012-04-20 08:24 PM
hello!
I have read the M-R . But I have some doubt in it . like the figure 65 in page 294 I don't understand the relation among CH1/CH2/CH3 . Whether CH1/CH2 is combined or CH1/CH3 is combined or CH1/CH2/CH3 is combined .2012-04-20 08:25 PM
hello!
I have read the M-R . But I have some doubt in it . like the figure 65 in page 294 I don't understand the relation among CH1/CH2/CH3 . Whether CH1/CH2 is combined or CH1/CH3 is combined or CH1/CH2/CH3 is combined .2012-04-20 08:27 PM
hello!
I have read the M-R . But I have some doubt in it . like the figure 65 in page 294 I don't understand the relation among CH1/CH2/CH3 . Whether CH1/CH2 is combined or CH1/CH3 is combined or CH1/CH2/CH3 is combined .2012-04-20 08:28 PM
2012-04-20 08:29 PM
2012-04-20 08:30 PM