FTM0/FTM1 on KE02 with MCUXpresso

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

FTM0/FTM1 on KE02 with MCUXpresso

跳至解决方案
1,765 次查看
justusandjustic
Contributor III

I am attempting to use MCUXpresso with an S9KEAZN64 processor. I'm currently trying to set up a timer with FTM. I looked at one of the demo projects for setting up a timer using FTM2. The demo works, but when I try to use FTM0 or FTM1, I encounter a Hard Fault. I have created projects on KDS with Processor Expert using FTM0/FTM1 as timers, so I looked through the libraries there for a clue. I also looked in the Reference Manual for KE02 chips, which is where I found this statement:

"This device contains up to three FTM modules of one 6-channel FTM with full functions
and two 2-channel FTM with basic TPM functions."

Comparing the KDS library code to the MCUXpresso SDK code, it seems that the FTM0/FTM1 only have registers corresponding to the first four members of the FTM_Type struct, while FTM2 has registers for the rest of them as well. Many of the fsl_ftm.c library functions attempt to access the registers that do not exist for FTM0/FTM1, which seems to be causing my Hard Faults.

What then is the proper way to use these "basic" FTMs with the MCUXpresso SDK? Or do I need to make my own initialization functions and access the registers directly?

-Josiah

1 解答
1,634 次查看
justusandjustic
Contributor III

So I actually solved this before I finished typing my question, but I figured I would still post it, in case it helps someone else in the future.

It turns out that there is a driver library (fsl_tpm.c/.h) for TPM timer modules in the MKE02Z64xxx4 SDK I was using for MCUXpresso. In all the documentation that I found, these components were referred to as "FTM0" and "FTM1", so naturally I assumed they should work with the FTM libraries (fsl_ftm.c/.h). The only clue was in the reference manual where they described the first two timer modules as having "basic TPM functions". This lead me to think that perhaps there was a TPM library, and behold, there indeed was.

-Josiah

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,634 次查看
carlosflr
Contributor II

I had been struggling for two days trying to use #FTM0 in a #MKE02Z64 using MCUXpresso IDE V11.1 with SDK 2.7. I wanted to use a PWM channel to drive a buzzer. Adding FTM0 peripheral using ConfigTools triggers a hard fault during initialization. I then found your post and tried removing this peripheral from ConfigTools and initializing it manually (using the TPM driver example in the SDK as a reference). This solved my problem. It must be a bug in ConfigTools.

Thanks for posting your solution!

-Carlos

1,634 次查看
justusandjustic
Contributor III

Yes, there doesn't seem to be a "TPM" Peripheral, so you have to set up those timers manually.  There also doesn't seem to be an "ADC" Peripheral for that chip family, which is pretty annoying as well. :/

I'm glad my post helped save you from some additional frustration!

-Josiah

0 项奖励
回复
1,635 次查看
justusandjustic
Contributor III

So I actually solved this before I finished typing my question, but I figured I would still post it, in case it helps someone else in the future.

It turns out that there is a driver library (fsl_tpm.c/.h) for TPM timer modules in the MKE02Z64xxx4 SDK I was using for MCUXpresso. In all the documentation that I found, these components were referred to as "FTM0" and "FTM1", so naturally I assumed they should work with the FTM libraries (fsl_ftm.c/.h). The only clue was in the reference manual where they described the first two timer modules as having "basic TPM functions". This lead me to think that perhaps there was a TPM library, and behold, there indeed was.

-Josiah

0 项奖励
回复