PWM (FTM0_CHx) support in TWRK60 and MQX

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

PWM (FTM0_CHx) support in TWRK60 and MQX

Jump to solution
2,011 Views
MarkP_
Contributor V

Hi,

need to generate PWM-output signals (25kHz, 1024 steps) with FTM0_CH0..3.

Is there any example code or support in MQX's BSP or PSP-library.

Does CW's Processor Expert has any PWM component for K60?

Should the PE work in free (code size limited) CW, version is 10.1?

BR,

Mark

0 Kudos
1 Solution
486 Views
Clark
NXP Employee
NXP Employee

HI, 

 

 The FTM_init component will generate a PWM.  However, in user code you have to use: 

 

FTMx_CxV = (unit32_t)0xXXXXUL;

 

to set the pulse width.  PE initializes the FTMx_CxV registers incorrectly before the FTMx_SC register.  I believe that this will be fixed in 10.2

 

Clark

 

 

View solution in original post

0 Kudos
3 Replies
487 Views
Clark
NXP Employee
NXP Employee

HI, 

 

 The FTM_init component will generate a PWM.  However, in user code you have to use: 

 

FTMx_CxV = (unit32_t)0xXXXXUL;

 

to set the pulse width.  PE initializes the FTMx_CxV registers incorrectly before the FTMx_SC register.  I believe that this will be fixed in 10.2

 

Clark

 

 

0 Kudos
486 Views
ProcessorExpert
Senior Contributor III

Than you for feedback, we have fixed this problem for upcoming CodeWarrior for MCUs V10.2 release.

 

best regards
Petr Hradsky
Processor Expert Support and Servicepacks Team

0 Kudos
486 Views
ProcessorExpert
Senior Contributor III

Hi,

 

You can  use the Processor Expert (PEx) to customize BSP (since MQX version 3.7) that you can use in your MQX aplication.  Into such BSP project, you can add PEx components you need, for examaple you can use TimerUnit_LDD component to provide PWM functionality.


There is already a example BSP project inside MQX 3.7 using Processor Expert for Kinetis TWR-K60 board insed MQX directory ...\Freescale MQX 3.7\mqx\build\cw10\bsp_twrk60n512_pe.
This project contains an example of PWM component.
 
Usage of this BSP in application code is demonstrated in pe_demo project in the demo directory: ...\Freescale MQX 3.7\demo\pe_demo.

 I recommend to use these projects as a start otherwise you would need to configure many settings if you like to start from an empty project.

Regarding second question - yes, PEx works also in the free limited CW version.

 

best regards
Petr Hradsky
Processor Expert Support Team

0 Kudos