Input edge capture problems, doesn't detect edges

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

Input edge capture problems, doesn't detect edges

Jump to solution
2,674 Views
mikelgodoy
Contributor I

Hi,


I'm developing a motor control program with Simulink using the Motor Contol Toolbox. I am currently using the following boards:

- TWR-KV31F120M

- TWR-MC-LV3PH

And the controlled motor is a BLDC type: Linix 45ZWN24-40.

I need to read the hall sensors signal to know the rotor position and make a trapezoidal control, so I have configured PTB18, PTB19 and PTA13 pins in Input Edge Capture blocks connected to FTM2_CH0, FTM2_CH1 and FTM1_CH1, as it says in user manual, then I could read the pin logic via GPIO to know the motor position.

When I try to read the signal logic via GPIO input, I can see that FTM1_CH1 is the only one that detects rising and falling edges. FTM2_CH0 and FTM2_CH1 detect nothing. Am I doing something wrong? Does FTM need to be initialized in some way to work in capture mode? Why is FTM1 working and FTM2 not?

Thank you all.

0 Kudos
1 Solution
2,141 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Mikel, 

Unfortunately i do not have your hardware available for me to try so the only thing i can do for you is a schematic analysis.

#1: according with TWR-MC-LV3PH http://www.nxp.com/assets/documents/data/en/user-guides/TWRMCLV3PHUG.pdf  Table 5, the hall signals go PCIe Tower System PRIMARY connector on A33/A34/B34 as TMR0/1/2.

Capture.JPG

Capture.JPG

#2: according with TWR-KV31F120M schematics http://www.nxp.com/assets/downloads/data/en/schematics/TWR-KV31F120M_SCH.pdf these TMR0/1/2 are routed to PTA13/PTA12/PTD6

Capture.JPG

Can you please modify your Simulink GPI read model to read hall signals from PTA13/PTA12/PTD6 sources. Does it shows all hall transitions ?

Hope this helps!

Daniel

View solution in original post

8 Replies
2,141 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Mikel,

What user manual are you following to configure the GPIOs for Hall sensor input capture ? Can you leave a link or attach the file ?

Can you check with an oscilloscope that all Hall signals reach the MCU pins ?

Perhaps you need to configure the board to re-route those signals: i see PTB19 is used for LED as default while PTB18 goes via a resistor.

 

Let us know your findings!

Best regards,
Daniel

0 Kudos
2,141 Views
mikelgodoy
Contributor I

Hi Daniel, 

I see that MCU's PTA13 pin changes its voltage between 0 and 5V for diferent rotor positions, while PTB18 and PTB19 do not. PTB18 maintains constant value of 1.27V and PTB19 varies between 2 and 3. They do not work as configured.

Regards,

Mikel.

0 Kudos
2,141 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Mikel,

The easiest way to validate that signals are reaching into processor is to create a simple model with 3 digital input blocks that read data from those general purpose pins. Route the digital input blocks outputs to 3 variables and check them with Freemaster. 

Capture.JPG

Digital input block is doing all the setup necessary for PORT. If the variables are not changing into Freemaster viewer then it means that something else is interfering with the signals on the boards.

Please keep us updated with the progress.

Hope this helps!

Daniel

0 Kudos
2,141 Views
mikelgodoy
Contributor I

Hi,

I have attached the image with the signals I get to the first message.

It's clear that something is not right.

Thanks for your help,

Mikel

0 Kudos
2,142 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Mikel, 

Unfortunately i do not have your hardware available for me to try so the only thing i can do for you is a schematic analysis.

#1: according with TWR-MC-LV3PH http://www.nxp.com/assets/documents/data/en/user-guides/TWRMCLV3PHUG.pdf  Table 5, the hall signals go PCIe Tower System PRIMARY connector on A33/A34/B34 as TMR0/1/2.

Capture.JPG

Capture.JPG

#2: according with TWR-KV31F120M schematics http://www.nxp.com/assets/downloads/data/en/schematics/TWR-KV31F120M_SCH.pdf these TMR0/1/2 are routed to PTA13/PTA12/PTD6

Capture.JPG

Can you please modify your Simulink GPI read model to read hall signals from PTA13/PTA12/PTD6 sources. Does it shows all hall transitions ?

Hope this helps!

Daniel

2,141 Views
mikelgodoy
Contributor I

Hi Daniel,

Yes, it shows all hall transitions reading PTA13, PTA12 and PTD6.

The problem was that when using input edge capture block, FTM2 only lets to configure PTB18 and PTB19 pins in capture mode.


PTA12 and PTA13 can be configured in FTM1, but it is not possible to set PTD6 in capture mode.

This solved my problem, thank you very much!
Mikel.

0 Kudos
2,141 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Mikel,

Just for the records, what you are pointing as functionality is a special mode of FTM operation that is designed to offload the CPU computation for motor speed and position.

Capture.JPG

To take benefit of it you need to design your custom board to feed the hall signals to that particular input pins.

The devkit you are using are built to be generic and to pack as much functionalities as possible in a small footprint.  

Best regards,

Daniel

0 Kudos
2,141 Views
mikelgodoy
Contributor I
Hi Daniel,
Thanks for your reply. I'm attaching the reference manual I'm using.
I checked all Hall signals reach the TWR-MC-LV3PH board, but didn't if they reach the MCU pins. Unfortunately I can't check it today.
Regards,
Mikel.
0 Kudos