How do I create a 38kHz signal with kl43z?

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

How do I create a 38kHz signal with kl43z?

跳至解决方案
1,037 次查看
christopherira
Contributor III

Hello yall,

 

I need a 38kHz signal for the IR LED I am using. I'm using kl43z, SDK, and PE.

At the moment I'm using a for loop so it waits for 13 microseconds and toggle command to turn off and on the IR LED.

My code is the following:

138616_138616.pngpastedImage_0.png

I don't know if the for loop is creating the desired 13 micro seconds. But I did the calculation assuming a clock speed of 8MHz.

The clock might actually be 48MHz? So then I'd do 624 no-ops.

 

But alas, the circuit is not working. I got the circuit working on an arduino and downloaded a code that had the 38kHz signal.

 

Also bonus question, I haven't been able to get the GPIO_DRV_ClrPinOutput or the GPIO_DRV_SetPinOutput commands to work.

The only thing that works is the GPIO_DRV_TogglePinOutput.

 

Thanks for the help!

 

-Chris

标签 (1)
标记 (4)
0 项奖励
回复
1 解答
862 次查看
DavidS
NXP Employee
NXP Employee

Hi Christopher,

I would use the KL43 TPM module to generate a PWM of 38kHz with 50% duty cycle.

Attached is KDS_3.0+KSDK_1.3+PE that does this.

You can measure (and see) the 38kHz signal on the green LED of the FRDM-KL43Z Freedom board.

I used a fsl_tpm Processor Expert Component to set it up.

Regards,

David

在原帖中查看解决方案

0 项奖励
回复
1 回复
863 次查看
DavidS
NXP Employee
NXP Employee

Hi Christopher,

I would use the KL43 TPM module to generate a PWM of 38kHz with 50% duty cycle.

Attached is KDS_3.0+KSDK_1.3+PE that does this.

You can measure (and see) the 38kHz signal on the green LED of the FRDM-KL43Z Freedom board.

I used a fsl_tpm Processor Expert Component to set it up.

Regards,

David

0 项奖励
回复