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
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.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
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
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!
-----------------------------------------------------------------------------------------------------------------------