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!
Solved! Go to Solution.
Hi,
These are all my configurations, it is working Ok. I am using the FRDM-K64F.
Best regards,
Earl.
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.
Best regards,
Earl.
Hi Earl,
I have followed your instruction. Should I set "initialization" since I have added "init_FTM" component? Thanks!
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.
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.
Best regards,
Earl.
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!
Hi,
These are all my configurations, it is working Ok. I am using the FRDM-K64F.
Best regards,
Earl.
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.
Of the following, i'm only edit de configuration and initialization options as shown.
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.
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.
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.
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
You are right Alberto, if you have any other problem please let me know.
Best regards,
Earl.