Why does the standard code provided for input capture mode of K66 doesn't work out of the box?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why does the standard code provided for input capture mode of K66 doesn't work out of the box?

893 Views
thequantumphysi
Contributor I

This nice document: https://cache.nxp.com/docs/en/application-note/AN5142.pdf 

provides many code examples on how to program K66 chips with FTM. On my Teensy 3.6 (which uses K66), the code for "Phase-shift PWM signal" from section 3.4 works perfectly well. However, the code from "Single-edge capture mode" in section 3.8 doesn't work. Both use FTM0, and both should be using the same ports. For capture mode, I expect to input a signal at FTM0_CH0, and then get the interrupt triggered to modify the value of diff. But I noticed that the interrupt is never called.

What am I missing? Please assist.

Thank you.

0 Kudos
4 Replies

684 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Samer,

Sorry for the inconvenience! This section may lack the NVIC setting of FTM0.

Please refer the method descripted in '3.1.2.1 Configuring the NVIC' of KQRUG.

3.1.2.1 Configuring the NVIC.png

Interrupt vector assignments.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
----------------------------------------------------------------------------------------------------------------------

0 Kudos

684 Views
thequantumphysi
Contributor I

Thank you for your response. Actually I tried adding this before asking the question:

    NVIC_ENABLE_IRQ(IRQ_FTM0);
But it didn't help. Would it be asking too much to provide a minimal working example?
0 Kudos

684 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Please download the SDK_2.2_FRDM-K66Fpackage refer Generating a downloadable MCUXpresso SDK v.2 package.

And then you can find the input_capture example in it's folder. (For example: C:\SDK_2.2_FRDM-K66F\boards\frdmk66f\driver_examples\ftm\input_capture)

FTM input_capture SDK_2.2_FRDM-K66F.png

FTM input_capture.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

684 Views
thequantumphysi
Contributor I

Thanks. I'll research and try this.

0 Kudos