Defineing multiple PWM componants on one TimmerUnit

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

Defineing multiple PWM componants on one TimmerUnit

跳至解决方案
1,260 次查看
avnergidron
Contributor III

Hi,

I am using the PE on the KDS 3.0.0 and kl25z128.

What I want to do is to define multiple PWM components on one TimerUnit(TPM) using its channels.

When I use the PE to define the PWM is gives me a warning saying that the enable function of one PWM component may affect the others that are defined on the same TimerUnit.

I ran code and that exactly what heppened. When I enabled one of the PWM the others strted to work also.

Is there a way to use each channel of the TimerUnit separately?

Thanks in advance!

Avner

标记 (3)
0 项奖励
回复
1 解答
1,059 次查看
marek_neuzil
NXP Employee
NXP Employee

Hello,

The Enable/Disable methods of the PWM component cause enable/disable of the whole TPM device (timer). Therefore you cannot use these methods for shared timer of the TPM device. You must use methods that control the TPM channels (PWM channels) only. For example you can set duty to 0% or 100% to set the required level output level of the pin or you can disconnect the channel pin by clearing MSB, MSA, ELSB and ELSA bits of the TPMx_CnSC register. In this case you can use for example PDD macros:

TPM_PDD_SelectChannelMode(TPM0_BASE_PTR, 0, TPM_PDD_OUTPUT_NONE);

TPM_PDD_SelectChannelEdgeLevel(TPM0_BASE_PTR, 0, TPM_PDD_EDGE_NONE);

Best Regards,

Marek Neuzil

在原帖中查看解决方案

1 回复
1,060 次查看
marek_neuzil
NXP Employee
NXP Employee

Hello,

The Enable/Disable methods of the PWM component cause enable/disable of the whole TPM device (timer). Therefore you cannot use these methods for shared timer of the TPM device. You must use methods that control the TPM channels (PWM channels) only. For example you can set duty to 0% or 100% to set the required level output level of the pin or you can disconnect the channel pin by clearing MSB, MSA, ELSB and ELSA bits of the TPMx_CnSC register. In this case you can use for example PDD macros:

TPM_PDD_SelectChannelMode(TPM0_BASE_PTR, 0, TPM_PDD_OUTPUT_NONE);

TPM_PDD_SelectChannelEdgeLevel(TPM0_BASE_PTR, 0, TPM_PDD_EDGE_NONE);

Best Regards,

Marek Neuzil