Switching FTM between PWM and Decoder; Possible SDK bug?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Switching FTM between PWM and Decoder; Possible SDK bug?

996件の閲覧回数
andy1
Contributor II

My application (for MK22FN512) requires sharing one of the FTMs between a PWM output and an Encoder. I had a hell of a time getting it to work using the SDK. (Using the functions in fsl_ftm.c)

After poking around a few hours I realized that once the FTM was switched into decoder mode, it would basically get "stuck" there. The PWM would never start counting again, even using the exact same code that works when called out of reset. It turns out that the QUADEN bit in QDCTRL does not get cleared.

These two lines solved my problem:

LED_PWM_FTM_BASEADDR->MODE |= FTM_MODE_WPDIS_MASK;
LED_PWM_FTM_BASEADDR->QDCTRL &= ~FTM_QDCTRL_QUADEN_MASK;

It seems to me that the SDK should clear this bit in FTM_Deinit or in the non-decoder setup functions (ie. FTM_SetupPwm).

I wasn't sure where to file a bug report, but figured this might help anyone that might run into the same problem.

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 返信

933件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Andrew Smolak,

I can see the QUADEN is cleared in FTM_SetupInputCapture and FTM_SetupOutputCompare but no in the non-decoder setup functions (ie. FTM_SetupPwm).

FTM_SetupInputCapture QUADEN.png

FTM_SetupOutputCompare QUADEN.png
I will report it to MCUXpresso SDK team.
Thank you for reporting this.  
Have a great day!

Best Regards,

Robin

 

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

0 件の賞賛
返信