FTM input capture with DMA - a cautionary tale

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

FTM input capture with DMA - a cautionary tale

942 Views
scottm
Senior Contributor II

I wasted hours on this today.  I was just about to post this as a question when I figured it out, so I'm posting this as a warning in case anyone else runs into the same bug.

I'm using an MK22FN1M0AVLH12 with Codewarrior 10.7.  For a soft UART implementation I need to use DMA to take values from an FTM channel in input capture mode.

This would seem to be fairly straightforward, but I found that whenever I'd check the results in the debugger, the entire buffer would be filled with the same (most recent) value.  This happened regardless of how I set up the number of major loop iterations. It'd trigger a transfer complete interrupt after 16 transfers, for example, and the debugger would stop in the ISR so I could check the results, and 512 entries would have the same value.

The cause?  The DMA_PDD_EnableDebug() macro's description is wrong.  It says it enables or disables the DMA controller in debug mode.  Which is sort of true, but it's misleading.  PDD_DISABLE does not disable the controller in debug mode - it clears the disable flag.  The sense is reversed.

This means that whenever I'd pause the debugger, the FTM would stop capturing, but apparently the channel flag doesn't clear while it's stopped, so the DMA transfer would run continuously with the most recent value.  It was capturing the right values all along - it was just overwriting them all as soon as I'd stop to look.

Scott

Labels (1)
Tags (3)
0 Kudos
Reply
3 Replies

651 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Scott,

Thank you for the feedback.

I checked the DMA_PDD_EnableDebug() description do add the confusion about State parameter.

I will forward that to CodeWarrior team and add more description info about this parameter.

Thanks again.

pastedImage_1.png


Have a great day,
Ma Hui

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

0 Kudos
Reply

651 Views
scottm
Senior Contributor II

Thanks.  If there's any chance that another PEx update will be released, I'd be happy to start making a list of bugs, inconsistencies, and documentation errors.  I generally haven't bothered anymore since it sounds like it's being phased out.

Scott

0 Kudos
Reply

651 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Scott,

I got the info from software team, there is no plan to continue develop Processor Expert tool so far. Thanks.


Have a great day,
Ma Hui

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

0 Kudos
Reply