Hard fault when configuring 2-channel FTM on E series

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

Hard fault when configuring 2-channel FTM on E series

Jump to solution
1,003 Views
rev
Contributor III

I'm seeing a hard fault exception when configuring FTM0 or FTM1 (both 2 channels) on a MK02Z16 device (also tested on KE06Z with same results).  The same code sequence works fine on FTM2 which 8 channels so not sure if that's a factor.  All of the example code I've found is for FTM2.

The code is simple:

SIM->SCGC |= SIM_SCGC_FTM1_MASK;

FTM1->MODE |= FTM_MODE_WPDIS_MASK;

The second line generates a hard-fault.  However writes to certain FTM registers do not generate hard faults (for example a write to the SC register is OK, so it appears that writes to legacy TPM registers are OK).

Is anyone aware of special considerations for FTM0 and FTM1 on E series devices?

Labels (1)
1 Solution
672 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Jonathan,

(For example  the KE06 )

- Which IDE do you  use , could you show all the code of  the FTM0 initialization ?

- The FTM0/FTM1 with basic TPM functions , the FTM2 module with full functions , also the available registers are different .

    (You can refer to the Reference manual pg82)

- If you use KDS or CW , you can use the PE to configure it , then you can see the generate code like this :

pastedImage_0.png

Hope it helps

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

Have a great day,

Alice

View solution in original post

2 Replies
673 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Jonathan,

(For example  the KE06 )

- Which IDE do you  use , could you show all the code of  the FTM0 initialization ?

- The FTM0/FTM1 with basic TPM functions , the FTM2 module with full functions , also the available registers are different .

    (You can refer to the Reference manual pg82)

- If you use KDS or CW , you can use the PE to configure it , then you can see the generate code like this :

pastedImage_0.png

Hope it helps

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

Have a great day,

Alice

672 Views
rev
Contributor III

Thanks Alice.  I didn't realize that FTM0 and FTM1 are not really FTM modules but TPM modules.  It's confusing because the FTM chapter lists registers that don't actually exist!  I wish that the reference manual chapters were specific to the actual functionality of the part.

I've changed my code to use TPM functions only for FTM0 and FTM1.

0 Kudos