I am using FTM module in output compare mode. I know Toradex doesn’t provide library for FTM module.
So I have developed the driver and it is partially working too. But I am not getting the desired result.
I have configured FTM in output compare mode with output toggle on channel match. Channel flag sets on channel match however nothing observed on channel output. I am attaching the source code for your reference. please try to debug the issue and do let me know the problem.link text
Secondly, I want to use an ISR when an event occurs at channel match in(FTM in output compare mode). FTMx_CnSC has a CHIE bit to enable the interrupt so we can enable the interrupt. But how one can trigger a function using this interrupt ? Please guide me, How to write ISR for the channel match interrupt?
I have referred the Toradex CE library lib demo for interrupts but didn’t get how to do it for my application ?
IRQ number for FTM1 is 17 + 32(IRQ_BASE), FTM2 is 18 + 32(IRQ_BASE). Please refer IRQ offset from the ARM Domain Interrupt Summary table in IMX7 processor TRM. Please use this IRQ number to Initialize the interrupt and process it.
FTM output compare: Please wait for a day, I will get back you tomorrow.
I was able to write the ISR for FTM module and run it successfully.
However I want to ask few questions:
From where this IRQ_BASE(32) comes in IRQ number as it is not written in ARM Domain Interrupt Summary in reference manual.
How to get interrupt for two different channels of FTM module ? for example what would be the IRQ number for FTM1.Channel0 and FTM1.Channel1? as IRQ number provided is for complete FTM1.
There is only one FTM counter for entire FTM module as per block diagram of FTM module in processor reference manual. What if one wants to use two different modes of FTM module with different configuration like he wants to use FTM1 in quadrature decoder mode and simultaneously FTM1.Channel1 in output compare mode.
From where this IRQ_BASE(32) comes in IRQ number as it is not written in ARM Domain Interrupt Summary in reference manual.
IRQ sources are coming from different
sources. There are some interrupts are
reserved for ARM core itself so that
IRQ_BASE starts at 32 for iMX7.
How to get interrupt for two different channels of FTM module ? for example what would be the IRQ number for FTM1.Channel0 and FTM1.Channel1? as IRQ number provided is for complete FTM1.
There are no multiple IRQ for
channel 0 and channel 1. You need to
write a thread for FTM interrupt that
should detect which channel flag is
set and handle the interrupt.
There is only one FTM counter for entire FTM module as per block diagram of FTM module in processor reference manual. What if one wants to use two different modes of FTM module with different configuration like he wants to use FTM1 in quadrature decoder mode and simultaneously FTM1.Channel1 in output compare mode.
I guess this should work as per your
expectation. I need to study
theoretically to confirm this. Please
wait for a few days, I will get back
you.
Please refer below picture and also Figure 12-5. FTM block diagram in i.MX7 TRM for more details.
So far, we never tested this combined functionality in one channel. Let us know if you have any other specific doubts, also you can post questions on NXP community and there you might get a reply.
I have already read this statement and I’m not clear about the functionality. That’s why asked this query to you. NXP is not responding properly that’s why we hope Toradex will respond.
We don’t have better contact with NXP. As like you, we should contact NXP for technical queries. If you have functionality shortage then you would think about using M4 core and writing gpio based software logic for quadrature decoder.
Sorry, we don’t have any other thing to share with you on this topic now.