cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get 4 Input Captures on TIM2

cosmapa
Associate II
Posted on June 23, 2008 at 10:54

Can't get 4 Input Captures on TIM2

3 REPLIES 3
cosmapa
Associate II
Posted on May 17, 2011 at 12:37

When I have TIM2 with all 4 channels configured as Input Capture, Capture on Ch1 doesnt work.

If I do not initialize Ch3, then I get captures on Ch1.

Has anyone experienced this?

Thanks

cosmapa
Associate II
Posted on May 17, 2011 at 12:37

Upon closer analysis, it looks like a problem with the Firmware library when initialising the timers. The code below actually load CCER with 0x1110 (Ch0 is disabled). By commenting the line that initilises Ch3, then CCER gets loaded with 0x1011 (Ch0 is enabled). When loading ''manually'' CCER with 0x1111 with TIM2->CCER = 0x1111, capture works on all 4 channels.

TIM_ICInitStructure.TIM_ICMode = TIM_ICMode_ICAP;

TIM_ICInitStructure.TIM_Channel = TIM_Channel_1;

TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising;

TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI;

TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1;

TIM_ICInitStructure.TIM_ICFilter = 0x0;

TIM_ICInit(TIM2, &TIM_ICInitStructure);

TIM_ICInitStructure.TIM_Channel = TIM_Channel_2;

TIM_ICInit(TIM2, &TIM_ICInitStructure);

TIM_ICInitStructure.TIM_Channel = TIM_Channel_3;

TIM_ICInit(TIM2, &TIM_ICInitStructure); // Comment out to make Ch0 work

TIM_ICInitStructure.TIM_Channel = TIM_Channel_4;

TIM_ICInit(TIM2, &TIM_ICInitStructure);

//TIM2->CCER = 0x1111;

TempWord = TIM2->CCER; // Read CCER to check

st3
Associate II
Posted on May 17, 2011 at 12:37

Quote:

it looks like a problem with the Firmware library

Which version?