Using FlexTimer module on iMX7D for Quadrature decoder

I am using iMX7D processor for my application( Using Toradex Colibri eval board iMX7D 512MB running Win CE 7.0 OS ). I’m trying to use its Flextimer ( FTM ) module in Quadrature decoder mode. Application being and optical encoder is connected to Phase A and Phase B inputs of FTM1 module and FTM counter should run(increment/decrements) based on these inputs. We have developed the FTM driver also. But we are not able to run it successfully so far.

I was looking for the support from the Toradex community and found the below link

Above link answered with respect to Linux OS. We are working for Win CE application,
so Is it required to create a proper device tree node in the i.MX 7 device tree with the adjusted register address/interrupts in case of Win CE OS also or a similar kind of thing ?

Bipin Kumar

Dear @bipin7301,

Thank you for contacting support.

There is no device tree concept for the WinCE. Also, we are not using any FlexTimer inside our WinCE BSP or standard release image. You need to use MapMem library to configure the FlexTimer desired functionality and use it. We have used FlexTimer in the PWM library, if you want to verify the FlexTimer functionality then you would check PWM_Demo application to confirm the same.

Please let us know if you have any other questions?

Thanks for Your response Raja,

We have developed driver for Flex timer in Quadrature decoder mode but unable to run it.
Can you please look into our driver for FTM and do let us know where we are going wrong ?

Please find src code in attachments.

Bipin Kumar

Dear @bipin7301,

Thank you for sharing source code.

I would like to check with you, did you read below community posts and other documentation






You may find some clues from the above links to solve the problem. Theoretically, I am just looking your source code to verify the configuration. Could you please wait for a few days and I will get back you soon.

Thank you

Hi Raja,

We have already read the community posts you have shared. In fact 4 out of the 5 posts are from our team member.

We are able to run the FTM in Quadrature decoder mode.

But one thing that we want to say is that you people are already working on iMX7 and developing the boards. You have already built expertise on these processors. We are expecting a better response from your side. In fact you people could have developed a demo application for all the users and include in your Toradex CE library.

Bipin Kumar

Hello @bipin7301,
we are also trying to do the same. I’ll be gald if i could get your contact details so that i can get in touch with you.

Hello @kshah ,
I can be reached at
My skype Id is bipin.kumar1989

Hello @bipin7301 ,
Are you getting an expected results now?
Can you please suggest how to read the data from rotary encoder with PWM pin.
Environment : IMX7 and WINCE

Hi @adder,

Yes we are getting expected results.
Please use the attached FTM initialisation routines for FTM in Quadrature decoder mode, they are working.

Just connect the encoder to PHA and PHB pin of FTM, Move the encoder and read the FTM counter. You will see counter changing values.

@bipin7301 , Thank you so much for your response ! I did it .