How do I create a 38kHz signal with kl43z?

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create a 38kHz signal with kl43z?

Jump to solution
259 Views
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

Labels (1)
Tags (4)
0 Kudos
1 Solution
84 Views
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

View solution in original post

0 Kudos
1 Reply
85 Views
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

View solution in original post

0 Kudos