What components do I need to output PWM using FTM module by Processor Expert ?

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

What components do I need to output PWM using FTM module by Processor Expert ?

Jump to solution
1,824 Views
gloria
Contributor III

I wamt to output PWM using FTM module by Processor Expert. I have added init_FTM component to initilize the FTM module. However, there is nothing output from the pin I choose. What elas should I do? Should I add fsl_ftm or fsl_ftm_hal component?

I just want to output 50MHz PWM from on channel and I use KDS3.0.

Many thanks!

1 Solution
1,312 Views
EarlOrlando
Senior Contributor II

Hi,

These are all my configurations, it is working Ok. I am using the FRDM-K64F.

pastedImage_0.png

pastedImage_1.png

Best regards,

Earl.

View solution in original post

0 Kudos
11 Replies
1,312 Views
EarlOrlando
Senior Contributor II

Hello,

You need to add the component fsl_ftm. Once it is added, in the Properties tab in the Component Inspector you will see the PWM Configurations.

pastedImage_0.png

pastedImage_1.png

Best regards,

Earl.

0 Kudos
1,312 Views
gloria
Contributor III

Hi Earl,

I have followed your instruction. Should I set "initialization" since I have added "init_FTM" component? Thanks!

0 Kudos
1,312 Views
EarlOrlando
Senior Contributor II

Hello,

You don't need the FTM_Init component. The fsl_ftm component includes the initialization, in the Component Inspector you can select the FTM instance that you want to use.

pastedImage_0.png

Also, if you need a 50MHz signal you need to configure your system clock as a multiple of 50 MHz (50 MHz, 100 MHz, etc). In the Initialization option you will be able to select what FTM channel(s) you want to configure as PWM output.

pastedImage_1.png

Best regards,

Earl.

0 Kudos
1,312 Views
gloria
Contributor III

Hi Earl, I have done all of this. But there is still no signal from the pin. Could you help me about this? Which one I set is not correct ? Many thanks for your kind help!

pastedImage_0.png

pastedImage_2.png

pastedImage_3.png

0 Kudos
1,313 Views
EarlOrlando
Senior Contributor II

Hi,

These are all my configurations, it is working Ok. I am using the FRDM-K64F.

pastedImage_0.png

pastedImage_1.png

Best regards,

Earl.

0 Kudos
1,312 Views
albertolubeiro
Contributor III

Hi Earl,

Apparently, i have done the same configuration options that you have but i don't get it to work. I am using KDS3.0.

Here is the bean i have selected.

pastedImage_0.png

Of the  following, i'm only edit de configuration and initialization options as shown.

pastedImage_2.png

pastedImage_3.png

Then in "Components_Init" function, the PEX creates these functions:

/*! flexTimer1 Auto initialization start */

  FTM_DRV_Init(FSL_FLEXTIMER1,&flexTimer1_InitConfig0);

  FTM_DRV_SetClock(FSL_FLEXTIMER1, kClock_source_FTM_SystemClk, kFtmDividedBy1);

  FTM_DRV_PwmStart(FSL_FLEXTIMER1,&flexTimer1_ChnConfig0,0U);

  FTM_DRV_SetTimeOverflowIntCmd(FSL_FLEXTIMER1,false);

  FTM_DRV_SetFaultIntCmd(FSL_FLEXTIMER1,false);

  /*! flexTimer1 Auto initialization end */

What else shall i do, in order to make the FTM works?

Any help will be apreciated

Thanks and best regards.

0 Kudos
1,312 Views
EarlOrlando
Senior Contributor II

Hello Alberto,

I have the same configurations and I get this 5 KHz signal:

pastedImage_0.png

I attach my project.

Best regards,

Earl.

1,312 Views
albertolubeiro
Contributor III

Hi earl,

Is there any problem in getting 2 PWM signals?. I can´t generate a PWM in FTM1_CH0 and other in PWM1_CH1. I only can get one of them, CH1 or CH2 but not both.

Why is this?

Thanks and best regards.

0 Kudos
1,312 Views
EarlOrlando
Senior Contributor II

Yes, you can have up to one PWM signal per each channel. If you need to use the two channels from the same instance (like in this case) you just need to call the function FTM_DRV_PwmStart (uint32_t instance, ftm_pwm_param_t *param, uint8_t channel) twice (once for every channel).

Have you configured the pin multiplexing (usually defined in the file pin_mux.c)?

Regards,

Earl.

1,312 Views
albertolubeiro
Contributor III

Hi Earl,

I meant two different frequencies in the same instance with different channels, but i have realised that this can't be done. I could get two PWM or more of the same frequency but with different dutycycle. For more than one frequency, i should use as many FTM as differents frequencies i want.

Thanks and best regards

0 Kudos
1,312 Views
EarlOrlando
Senior Contributor II

You are right Alberto, if you have any other problem please let me know.

Best regards,

Earl.

0 Kudos