PWM (FTM0_CHx) support in TWRK60 and MQX

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

PWM (FTM0_CHx) support in TWRK60 and MQX

跳至解决方案
2,919 次查看
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 项奖励
回复
1 解答
1,394 次查看
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 项奖励
回复
3 回复数
1,395 次查看
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 项奖励
回复
1,394 次查看
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 项奖励
回复
1,394 次查看
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 项奖励
回复