K22F not triggering DMA on FTM input capture

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

K22F not triggering DMA on FTM input capture

615 Views
scottm
Senior Contributor II

I seem to be having one of those days where simple things just aren't working, for no apparent reason.  I'm hoping someone will be able to catch what I'm missing.

This part of my project was working.  Version control is a little wonky and for reasons beyond the scope of this post it's going to be hard to roll back to the last known good version.

I'm using an MK22FN1M0AVLH12.  I've got FTM0 channel 2 set up for input capture on pin 46, with FTM0-C2SC:DMA set.  DMA is set up to transfer the channel value register to a buffer on each channel event.  It used to work, and now it doesn't.  If I disable the signal source and clear the channel flag, the channel flag stays cleared until I hook up the signal source again.  That tells me that the pin mux setup is right and the input capture is working.

If I set the START bit on the DMA channel (TCD6), it'll complete a transfer with the right source and destination, so that part works.  It's just that the FTM channel never triggers DMA on its own.

DMAMUX channel 6 is set to source 22, which is FTM0 CH2.  TRIG is 0 (no PIT trigger), ENBL is 1.  DMA-ES shows no errors,  DMA-ERQ:ERQ6 is set.  HALT is 0 and other DMA transfers are working.  DCHPRI6 is 6, and all DMA priorities are set uniquely.

What the heck am I missing here?  The channel flag (FMT0-C2SC:CHF) is set and FTM0-C2SC:DMA is set, so that should be generating a trigger on DMA source 22, right?  It ought to pass through DMAMUX and trigger the DMA channel, but it doesn't.  The other DMAs are functioning normally.

Thanks,

Scott

Labels (1)
Tags (1)
0 Kudos
2 Replies

509 Views
jianfengzheng
Contributor II

The FTM Channel Interruption must be also enabled, i.e. FTMx_CnSC CHIE = 1

0 Kudos

509 Views
scottm
Senior Contributor II

Ok, I figured it out - both the DMA and CHIE bits have to be set.  Looks like I made a mistake at some point when migrating off of the old PEx PDD to KSDK.

0 Kudos