how use pwm capture in s32k116bldc - official website demo

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

how use pwm capture in s32k116bldc - official website demo

551 Views
misfitsyu
Contributor I

HI  every engineers:

      In MCSPTE1AK116_BLDC_6STEP  demo,using the module of flexTimer_mc0. I don't understand what it does. but ,It is based on FTM1.    now  I  want to use FTM1  to do pwm capture . Because of flexTime_mc0,the process expert wouldn't allow me to use FTM1's capture feature.

     so  How can I modify the code to use FTM's capture feature while keeping the motor working properly?

0 Kudos
Reply
3 Replies

534 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @misfitsyu,

The FTM1 operation is explained in AN13000 that can be found in the installation directory of the SW:

c:\NXP\MC_DevKits\MCSPTE1AK116\doc\ApplicationNotes\ 

 

Unfortunately, the SDK drivers do not allow running more drivers on the same HW module.

Because the IC driver would reinitialize the module previously initialized by the MC driver or vice-versa.

You could use the other channels of the FTM1 for IC but you would need to write it yourself.

There are non-SDK examples in the S32DS IDE that should help you with that.

However, the FTM1 clock is prescaled to just 750kHz and there is only one counter per FTM instance.

So, the resolution of the IC would be 750kHz too.

 

Regards,

Daniel

 

0 Kudos
Reply

528 Views
misfitsyu
Contributor I

HI   Daniel !

     I've looked at the examples captured in the sdk. The routine uses the time polling method to read CNT. I want to know how to distinguish the rising edge and the falling edge.

    Or, I want to read the CNT of the rising and falling edges by means of PORT_IRQHandler without going to the mc mode. Is that OK?   AND,how can i  do it?

0 Kudos
Reply

519 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @misfitsyu,

The FTM has two IC modes.

It is explained in AN5303 Features and Operation Modes of FlexTimer Module on S32K

https://www.nxp.com/docs/en/application-note/AN5303.pdf

3.5. Single-edge capture mode

3.6. Dual-edge capture mode

 

In theory. I suppose you could use other channels of FTM1 for the IC. But not with the FTM SDK driver.

Or, as you said, read CNT from the PORT ISR, the PORT interrupt can be active on both edges.

However, I'm looking at the AN13000 3-phase Sensorless BLDC Motor Control Kit with S32K116.

It uses PORT interrupt to capture commutation time and the ISR resets the FTM1 counter.

 

Maybe you can use the LPIT timer for this purpose instead.

 

Regards,

Daniel

 

 

 

0 Kudos
Reply