Why do some input edges fail to cause a FTM capture?

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

Why do some input edges fail to cause a FTM capture?

ソリューションへジャンプ
1,198件の閲覧回数
lancefisher
Contributor III

I'm trying to use the three input XOR function of FTM2 in input capture mode on a KV11Z128 to measure the speed of a BLDC motor.  I have the three hall effect sensor signals wired to PT_A1, PT_A2, and PT_D7.  Those three ports are configured to be internally connected to the FTM2_CH0, FTM2_CH1, and FTM1_CH1 inputs.  The bit in SIM_SOPT4 is set.  FTM2 is configured for input capture on both edges of the input signal.  I'm getting captures and the associated interrupts on only 4 of the 6 transitions of the hall inputs.  I have verified that all three signals are present and sequencing correctly both with an oscilloscope and by examining the GPIO port bits when the debugger breaks after advancing the motor one phase of the six phase sequence.  The behavior is slightly different depending on the sequence direction.

The sequence on the inputs (D7/A2/A1) with CW rotation is 1,5,4,6,2,3 and I get a capture on the transitions between phases except from 2 to 3 and from 5 to 4.  With CCW rotation the sequence is reversed and all transitions except 3 to 2 and 4 to 5.  The problem occurs no mater what speed the motor is running including about one magnetic rotation per second and several hundred RPS.  The missing captures and channel interrupts are very consistent.#

I even verified that the Port Pin Control Register Mux values are correct for the three inputs I'm using and I checked that none of the other possible ports that can connect to FTM2_CH0, FTM2_CH!, and FTM2_CH1 are in conflict.

The program is running on a FRDM-KV11Z board which has a MKV11Z128 processor and I'm using KDS 3.2 with SDK 1.3 and Processor Expert.

The functionality I'm trying to used was discussed (for a KV58) here: Hall Sensor implementation with KV5x

What could be causing this?

ラベル(1)
0 件の賞賛
1 解決策
946件の閲覧回数
lancefisher
Contributor III

Hallelujah!  I had a thought that perhaps I could confirm that FTM2_CH0 was connected to my input by configuring FTM2_C0SC for input capture on both edges and combine the captured times from both channels.  But with that not only did I get Channel 0 capture events for the missing edges, I also got Channel 1 capture events for them.  Until now Channel 0 was configured for input capture with no edges (ELS0A and ELS0B = 00) which apparently not only disables the Channel 0 capture function, it also disconnects the Channel 0 input from the XOR feeding Channel 1.Now it appears that my code is working correctly with Channel 0 configured for capturing both edges (probably any configuration for Channel 0 except ELS0A,B = 00 would work.

元の投稿で解決策を見る

0 件の賞賛
4 返答(返信)
946件の閲覧回数
FelipeGarcia
NXP Employee
NXP Employee

Hi Lance,

 

Thanks for sharing your solution with the community!

 

Best regards,

Felipe

0 件の賞賛
947件の閲覧回数
lancefisher
Contributor III

Hallelujah!  I had a thought that perhaps I could confirm that FTM2_CH0 was connected to my input by configuring FTM2_C0SC for input capture on both edges and combine the captured times from both channels.  But with that not only did I get Channel 0 capture events for the missing edges, I also got Channel 1 capture events for them.  Until now Channel 0 was configured for input capture with no edges (ELS0A and ELS0B = 00) which apparently not only disables the Channel 0 capture function, it also disconnects the Channel 0 input from the XOR feeding Channel 1.Now it appears that my code is working correctly with Channel 0 configured for capturing both edges (probably any configuration for Channel 0 except ELS0A,B = 00 would work.

0 件の賞賛
946件の閲覧回数
lancefisher
Contributor III

I've scoped the sensor inputs and they are correct.  I'm actually using the same signals to successfully commutate the motor.  My issue is that even though all three hall inputs are theoretically XOR'd to feed the capture input (FTM2_CH1)  I'm only getting  capture events when the inputs feeding FTM2_CH1 or FTM1_CH1 change state.  Transitions on the input feeding FTM1_CH0 fail to cause a capture event on FTM2.  This suggests that something is wrong with the signal feeding FTM1_CH0 which is port A1 in my code.  I have confirmed via the debugger that the PORTA-PCR1 mux field is set to 3 which according to the pinnout chart in the KV11P64M75RM pdf document should select FTM2_CH0 as the destination for this pin. I also tried all of the other 6 values for that field with the same effect.  In addition I confirmed that the PCR mux fields for the other two potential sources for FTM2_CH0 (Ports C1 and D4) are not set to 5 (the value that selects FTM2_CH0) and that the GPIO configuration for port A1 is an input and that the clock for port A is enabled.  Finally, using the debugger to examine the PORTA DIR I can see bit 1 following the hall effect channel feeding that pin.

Clearly something is preventing the input on port A1 from driving FTM2_CH0 but I haven't found what that is yet.

0 件の賞賛
946件の閲覧回数
FelipeGarcia
NXP Employee
NXP Employee

Hi Lance,

 

I checked the schematic of the FRDM board you are working on and the pins are correct. Please double check the position of the sensors as they must be placed at 120 degrees apart around the rotor.

 

Unfortunately, we don't have a demo using BLDC motor and Hall sensors on KDS. However, you can take a look to the AN4776SW developed for CodeWarrior and FRDM-KE02Z.

 

Best regards,

Felipe

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛