cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746 Using TIM8 in Encoder mode is not working with Input capture on both edge ???

MJ_1992
Associate II

I need to run TIM8 on Encoder mode. My encoder has two channels (A and B 90 degrees), So I have used two channel TIM_CHANNEL_1 and TIM_CHANNEL_2 as encoder input (it will use encoder as a clock for TIM8) and my timer is working fine and CNT is updating as I am rotating the encoder.

Now, I want to use the INPUT CAPTURE SIGNAL for TIM8. So I am using TIM_CHANNEL_3 as input capture channel. I need to capture count at both edges, So I set CC1NP/CC1P = 0x11 but as per RM0385 page 687, I can't do that for both edges. It says "This configuration must not be used in encoder mode". But CubeMX IDE is allowing me to do so.

I think I can't use TIM_CHANNEL_1 or TIM_CHANNEL_2 as INPUT CAPTURE with both EADGE detection, but I can use TIM_CHANNEL_3 because it is a stand-alone channel. Am I right?

In RM0385 they have given an explanation for only for CC1P but not CC3P. So it is confusing for me.

1 ACCEPTED SOLUTION

Accepted Solutions

> but I can use TIM_CHANNEL_3 because it is a stand-alone channel. Am I right?

Yes.

The "polarity selector" for CH1/CH2 works for encoder indeed - try setting one of them, it will change "direction of rotation" (it may come handy sometimes). I don't know what would happen if you'd select the "both edges" for CH1/CH2, but I guess the warning is there for reason.

JW

View solution in original post

1 REPLY 1

> but I can use TIM_CHANNEL_3 because it is a stand-alone channel. Am I right?

Yes.

The "polarity selector" for CH1/CH2 works for encoder indeed - try setting one of them, it will change "direction of rotation" (it may come handy sometimes). I don't know what would happen if you'd select the "both edges" for CH1/CH2, but I guess the warning is there for reason.

JW