2021-09-05 12:30 PM
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.
Solved! Go to Solution.
2021-09-06 12:03 AM
> 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
2021-09-06 12:03 AM
> 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