How to trigger an interrupt with software on an ftm channel set up as input capture?

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

How to trigger an interrupt with software on an ftm channel set up as input capture?

Jump to solution
3,057 Views
jamesnimmer
Contributor I

I'm working on a BLDC motor control project and I have the ftm's set up correctly for the outputs and inputs, however, I can only start the motor by first moving the motor shaft by hand to set a flag bit on a channel to start my commutation sequence. In other words, I need to know how trigger the interrupt I have set up for the halls with software so I can start the motor without touching it. Any ideas would be appreciated. 

Labels (1)
0 Kudos
1 Solution
2,590 Views
pavelgrasblum
NXP Employee
NXP Employee

Hi James,

if I understand well, you read halls state using input capture. If the motor is stopped, there is no capture event, which would read the halls state and commutate the motor. There is no way how to force capture event by the software. For correct start of the BLDC motor you need to read initial rotor position and apply correct voltage according to required direction of rotation. Applying the voltage on the motor the rotor will move and the commutation will continue via input capture interrupt. This start up sequence you need to apply any time there is request to run motor. Simply said, you need to run the same code you have your interrupt routine (halls state reading + commutation routines) during every motor start up.

View solution in original post

0 Kudos
2 Replies
2,591 Views
pavelgrasblum
NXP Employee
NXP Employee

Hi James,

if I understand well, you read halls state using input capture. If the motor is stopped, there is no capture event, which would read the halls state and commutate the motor. There is no way how to force capture event by the software. For correct start of the BLDC motor you need to read initial rotor position and apply correct voltage according to required direction of rotation. Applying the voltage on the motor the rotor will move and the commutation will continue via input capture interrupt. This start up sequence you need to apply any time there is request to run motor. Simply said, you need to run the same code you have your interrupt routine (halls state reading + commutation routines) during every motor start up.

0 Kudos
2,590 Views
jamesnimmer
Contributor I

Hi Pavel,

I assumed this was the answer but given the vast capabilities of the ftm's, I was thinking there was an easier way, but I guess not. Thank you for the response!

-James

0 Kudos